Databases: going deeper

Lesson 06 · 16 min

The query planner and EXPLAIN ANALYZE

Scan types, join algorithms, estimates versus reality, and the statistics the planner bases its decisions on.

16 minLesson 6 of 10Practice includedAsk AI on any point

SQL says what to fetch, not how. The planner chooses the path: it considers alternatives, computes an abstract cost for each and runs the cheapest. The cost depends on the estimated row count, and the estimate comes from statistics. Most slow queries come down to an estimate somewhere in that chain drifting away from reality.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.