SQL lab

Index vs sequential scan

Count the pages a sequential scan and a B-tree index lookup read to find one row.

InteractiveSeq scan vs. index lookup
Loading interactive…

The sequential scan reads every page even after it finds the row; the index scan reads one page per tree level plus a single heap page. On a bigger table the first number would grow with it, while the second would barely move.

Learn the concept

The lesson this lab comes from, with the explanation, a practice task and a quiz.

More labs

All labs