ByteByteGo on YouTube · Open on YouTube
Professional practice: how analytics teams actually work · Competent · Lesson 32 of 99 · 6 min video, then about 4 hours of practice
Writing SQL that does not time out: execution order, plans and indexes
After this you can read a query plan, explain why a query is slow, and apply the common fixes (filter early, avoid unnecessary DISTINCT, select only needed columns, use indexes and partitions).
Why it matters
As data grows, a query that took two seconds on a sample takes twenty minutes in production and costs real money in a cloud warehouse. Learn the logical execution order, how to run EXPLAIN, and the handful of habits that fix most slow analyst queries. Note that cloud warehouses (BigQuery, Snowflake) rely on partitioning and clustering rather than traditional indexes, so 'add an index' is not always the answer.
How to use this resource
A six-minute explanation of SQL's logical execution order and how it guides optimisation.