Skip to content
skillbld
Day 10 of 14 35 minB-treeEXPLAINANALYZE

Make queries fast. Understand how a B-tree index finds rows, read query plans with EXPLAIN, create the right indexes, and know when an index won't help.

By the end of today you can

  • Explain how an index speeds up lookups
  • Read a query plan with EXPLAIN and EXPLAIN ANALYZE
  • Create single-column, multi-column and expression indexes
  • Recognise when PostgreSQL will (and won't) use an index
  • Weigh the cost of indexes on writes and storage

What's inside

  • 6 sections
  • 3 diagrams and mind maps
  • 6 code examples you can run
  • 5-question quiz
  1. 1A table worth indexing
  2. 2Without an index: a sequential scan
  3. 3How a B-tree index works
  4. 4Add an index and compare
  5. 5When an index isn't used
  6. 6Other kinds of index

Sign in free to read this lesson

Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.

Sign in free
Day 10: Indexes & Performance · PostgreSQL · SkillBld