Reading EXPLAIN

Ask Postgres what it's actually doing

EXPLAIN shows the query plan Postgres picked for a query, without running it โ€” just the plan and its cost estimate. EXPLAIN ANALYZE actually runs the query and adds real numbers: actual time, actual rows returned, how many times each step ran. When a query feels slow, this is the first thing to reach for, before touching any code.

The two scan types you'll see constantly: a sequential scan (Seq Scan) reads every row in the table, in order, checking each one against the filter. An index scan (Index Scan) uses a B-tree to jump straight to the matching rows without touching the rest of the table. On a table with a handful of rows, a seq scan is fine โ€” even faster, since there's no index to consult. On a table with a million bookings, a seq scan to find one walker's rows means reading all million.