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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Kevin Kline

Career and Technical Advice for the IT Professional


Explaining the bits and bytes of SQL Server and Azure

SQL Authority with Pinal Dave

SQL Server Performance Tuning Expert


A blog about PowerShell and general Windows sysadmin stuff

Simon Learning SQL Server

I'm trying to become "better" at SQL Server and data - here's how I'm doing it!

%d bloggers like this: