SQL & Relational Databases (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)
What is the difference between Clustered and Non-Clustered Indexes?
senior LevelMost Askedsql-databasesAdvanced Internals
In Simple Words:
- Clustered Index: Determines the physical, on-disk storage order of rows. Leaf nodes contain the actual full row data. A table can have only one clustered index (usually the Primary Key).
- Non-Clustered Index: A separate structure from data rows. Leaf nodes contain index keys and a pointer/row-locator (Primary Key value or physical Row ID) pointing to the data row in the clustered index/heap.