Press "Enter" to skip to content

A Good Reason to Explicitly Add Clustered Index Key to Covering Indexes

Some time ago I learned that the clustered index (CI) key is implicitly included in all non-clustered indexes (NCIs). This means that if I am creating a covering index for a query that features the CI key, I don’t need to explicitly add the key to the index. Excellent – less typing for me!

However, I also learned that explicitly adding the CI key doesn’t increase the cost of the index (as it’s already included). And it can be a useful habit to get into because it means that, if the CI key were changed in future, the covering index will still cover my query. Otherwise, I (or my colleagues) would have to find & change the affected covering indexes to add the CI key back in.

Note: when I use the word “included” above, I do not mean included columns.

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *