Friday, October 2, 2009

Impact of Multi-Column Clustered Index

Clustered Indexes are really important and special. Special because there can only be 1 Clustered Index in a table and they decide the order in which data is stored in tables.

Clustered Index help the database uniquely identify individual rows in a table. As mentioned in my previous blog if the Clustered Index do not uniquely identify a row, SQL Server automatically adds a 4 byte uniqueidentifier column to make it unique.

However we should be really careful not to add too many columns in a Clustered Index in trying to make it unique, because all Non-Clustered Indexes store the columns from Clustered Index at the end to point to a row in a table.

Therefore, more the no. of columns in a Clustered Index will be, more the size of Non-Clustered Index will be.

No comments:

Post a Comment