Medium sql database

Why does a B+ tree lookup on a large table read only a few pages?

A lookup follows one path from the root through intermediate levels to a leaf. The number of nodes on that path depends on the tree’s height, not directly on the table’s row count. Each index page can contain many key-and-pointer entries, allowing a large table to be searched through a shallow tree.

Editor’s note: Examples such as “about three pages for one million rows” are illustrations rather than guarantees. The actual height and I/O depend on key size, page occupancy, row size and fill factor; measure the real execution plan.

Sources (2)
  1. Microsoft Learn — root, intermediate and leaf levels of an index B+ tree
  2. Microsoft Learn — SQL Server page size