Compare

Side-by-side on the decisions that recur: index vs scan, normalize vs denormalize, optimistic vs pessimistic, partition vs shard, and more — with when to choose each.

Index ScanSequential Scan
How it worksDescend a B-tree, fetch matching rows by pointerRead every page of the table in order
Costlog(n) descent + one random read per matchLinear in table size, but sequential IO
Best whenSelective predicate (matches a few percent)Query needs most of the table, or no usable index
Worst whenPredicate matches a large fraction — many random readsSelective predicate on a big table — reads everything to keep little
The tell in EXPLAINIndex Scan / Index Only ScanSeq Scan with high Rows Removed by Filter
Choose this whenA highly selective lookup on a large table — a user by id, a row by email.A full aggregate, or a predicate that keeps more than ~20% of rows; the planner picks it and is right.