SQL Server Interview Question #221

How is a SQL Server B-tree index structured?

Advanced Indexing Senior Advanced

Detailed Explanation

Traditional rowstore indexes in SQL Server are organized as balanced tree structures with a root level, zero or more intermediate levels, and a leaf level. SQL Server can navigate from the root through intermediate pages to locate the required leaf pages efficiently.

In a clustered index, the leaf level contains the table's data rows. In a nonclustered index, the leaf level contains index rows plus a row locator to the underlying data. Understanding this structure explains why key order, page splits, index depth, and covering strategies affect performance.