internalsGet Pro

Module 02 · Lesson 11 of 12Pro

Writing fast analytical queries

Level
Intermediate
Topic
SQL for data engineering
Reading time
17 min

When you finish this page you can

  1. Estimate an analytical query’s work from the columns and row groups it reads and the rows each step carries.
  2. Rewrite a slow query by naming columns, filtering on the column the table is ordered by, and aggregating before joining.
  3. Explain why indexes matter far less in a columnar engine than min-max statistics per row group.
  4. Read DuckDB’s EXPLAIN ANALYZE output to find the operator that did the work.
  1. Design: a first analytics pipeline for an online store30 min
  2. Join pitfalls: duplicated and missing rows16 min

A year of add-to-carts takes six minutes

is an online store in India. Every night its data team copies the day’s orders and about 10 million click events from the store’s PostgreSQL read replica into a file. Daniel’s finance reports and the product team’s charts read from that file.

Our biggest sale ever · Black Friday

Flat 50% Off

Pro

Continue reading

Unlock every course, now and later

  • System Design, live
  • AI Engineering, live
  • Data Engineering, live
  • Machine Learning Engineering, live
  • Inference Engineering, coming soon
  • AI Research, coming soon
  • Performance Engineering, coming soon
  • Agent & Harness Engineering, coming soon
  • LLM Fine-tuning, coming soon
  • LLM Pre-training & Post-training, coming soon
  • Reinforcement Learning, coming soon
  • AI Infrastructure & Platform Engineering, coming soon
  • AI Evaluation & Safety, coming soon
  • Forward Deployed Engineering, coming soon
  • Cloud Computing, coming soon
  • DevOps, coming soon

50% off · Annual and Lifetime

BLACKFRIDAY50Applied at checkout

Choose a plan