Nonclustered indexes with primary key

Pet peeve.  Data tuning advisor – before I got to this job –  created some indexes with the first column which is the same as the primary key.    The names of the indexes usually have K1 listed as the first column.  If your primary key is the first column, this index could be inefficient.

Sometimes it could be helpful, if the table has a lot of columns.  In that case traversing a smaller index may be faster than reading the leaf pages of the clustered index.

But mostly, I don’t trust DTA, especially if it was run blindly before I got here.

To find these indexes with K1, here is a query to run:

SELECT *
FROM sys.indexes
WHERE name LIKE ‘%[_][_]K1[_]%’

Advertisements
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s