A clustered index sorts and stores the table’s data rows according to its key. Its leaf level contains the table data itself. A table can have only one clustered index because its data rows can be stored in only one order. Without one, its rows are stored in an unordered structure called a heap.
SQL Server implements rowstore indexes as B+ trees, while its documentation uses the general term “B-tree” for indexes.
CREATE CLUSTERED INDEX IX_Orders_Id ON Orders(order_id);
-- leaf pages are the table rows, stored in order_id order
-- a second clustered index is not possible on the same table
Sources (2)
- Microsoft Learn — clustered and nonclustered indexeslearn.microsoft.com
- Microsoft Learn — clustered index architecturelearn.microsoft.com