Conceptual
Login

Sequential Scan vs Index Scan

A sequential scan reads every table page in order (cheap per row, cost independent of selectivity); an index scan traverses the index and then fetches matching rows, paying a random heap access per row. The crossover is selectivity: past a few percent of rows, the random IO of an index scan costs more than reading the whole table.

Questions this Concept answers

  • Why does a sequential scan beat an index scan once a query wants a large slice of the table?