Skip to content

Instantly share code, notes, and snippets.

@SBajonczak
Created December 27, 2021 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SBajonczak/3aae2392f502ce6d17f0d13bda2afa39 to your computer and use it in GitHub Desktop.
Save SBajonczak/3aae2392f502ce6d17f0d13bda2afa39 to your computer and use it in GitHub Desktop.
Differences between Clustered Index and NonClustered Index
Parameters Clustered Non-clustered
Use for You can sort the records and store clustered index physically in memory as per the order. A non-clustered index helps you to creates a logical order for data rows and uses pointers for physical data files.
Storing method Allows you to stores data pages in the leaf nodes of the index. This indexing method never stores data pages in the leaf nodes of the index.
Size The size of the clustered index is quite large. The size of the non-clustered index is small compared to the clustered index.
Data accessing Faster Slower compared to the clustered index
Additional disk space Not Required Required to store the index separately
Type of key By Default Primary Keys Of The Table is a Clustered Index. It can be used with unique constraint on the table which acts as a composite key.
Main feature A clustered index can improve the performance of data retrieval. It should be created on columns which are used in joins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment