By Michael Nocito, data analyst · Published August 8, 2026

By the end of this page you can tell whether a query is reading your whole table or jumping straight to what it needs, add an index that changes which of those happens, recognise the three common ways a query throws away an index it already has, and say what indexes cost so you can argue for one honestly. It is about twenty-five minutes, and every timing below was measured on half a million rows.

Here is what to do today, on the query that is too slow. Put EXPLAIN QUERY PLAN in front of it, or EXPLAIN on Postgres and most others. If the answer contains the word scan against a large table, the engine is reading every row, and that is the fact worth having before you change anything.

The short version: an index is a sorted copy of one or more columns kept alongside the table, so the engine can jump to a value instead of walking past every row looking for it.

Walking against jumping is the idea, so it gets the picture.