In this post, I will explain the difference between Clustered Index and Non-Clustered Index.
Indexes are used to quickly locate data without having to search every row in a database table. An index is a copy of selected columns of data from a table that can be searched very efficiently that also includes a low-level disk block address or direct link to the complete row of data it was copied from.
A table can have two types of indexes:
- Clustered Index
- Non-Clustered Index
Sr No | Clustered Index | Non-Clustered Index |
1 | There can be only one Clustered Indexes for a table | There can be more than one Non-Clustered Indexes for a table |
2 | Data retrieval is faster than Non-Clustered Indexes | Data insertion/update is faster than |
3 | The leaf nodes of a Clustered Index contain the data pages | The leaf node of a Non-Clustered Index does not consist of the data pages. Instead, the leaf nodes contain index rows |
4 | Do not need extra space to store logical structure | Use extra space to store logical structure |
5 | Sort the records and store them physically according to the order | Do not affect the physical order. Create a logical order for data rows and use pointers to physical data files |
0 comments:
Post a Comment
Please do not enter any spam link in the message box.