1 Answers
Clustered Index vs Non-Clustered Index in SQL Server
Clustered Index:
- A clustered index determines the physical order of data in a table.
- There can be only one clustered index per table.
- Data rows in a table are sorted and stored in the order of the clustered index key.
- Clustered index is automatically created when the primary key is defined on a table.
- It speeds up data retrieval when the indexed columns are queried.
Non-Clustered Index:
- A non-clustered index does not alter the physical order of the table.
- Multiple non-clustered indexes can be created per table.
- Data rows are stored in a separate structure from the index, pointing back to the clustered index key or row identifier.
- Non-clustered index is recommended for columns that are frequently used in query conditions.
- It incurs additional storage overhead but can improve query performance for specific queries.
Overall, understanding the differences between clustered and non-clustered indexes is crucial for optimizing query performance and data retrieval in SQL Server.
Please login or Register to submit your answer