Diagnose SQL query performance with EXPLAIN plans
8 steps · about 2 h 10 min · Intermediate
- Read a PostgreSQL plan (article, Use The Index, Luke!, 18 min)
Learn the plan vocabulary before diagnosing a slow query.
- Compare estimated and actual work (article, PostgreSQL documentation, 15 min)
Spot where estimates diverge from execution.
- Inspect SQLite query plans (article, SQLite documentation, 15 min)
See the same diagnostic habit in a compact database.
- Use plans to ask better questions (article, Use The Index, Luke!, 20 min)
Connect plan operators to practical tuning questions.
- Choose an index family (article, SQLite documentation, 18 min)
Match B-tree, hash, GiST and GIN capabilities to predicates.
- Limit a partial index deliberately (article, PostgreSQL documentation, 16 min)
Learn when indexing only qualifying rows is worthwhile.
- Observe database activity (article, PostgreSQL documentation, 16 min)
Use runtime statistics to avoid tuning from guesses.
- Refresh planner statistics (article, PostgreSQL documentation, 12 min)
Understand why current statistics affect plan quality.