Question

My question is this: When running sp_blitzindex, I get a lot of these 2 warnings/suggestions:

Index Hoarder: Unused NC index

and

Feature-Phobic Indexes: Potential filtered index (based on column name)

With index hoarder, these are indexes that I've built against a FK column. I thought somewhere I read that was a good idea to have.

With feature-phobic, I had indexes set up to use these cols (where clause in the index definition), but when using sp_blitzindex, I got a lot of recommendations for indexes that didn't use the feature. (It either stuck the bit field in the includes or in the index itself.)

What are your thoughts on whether or not to keep the indexes on the FKs? And, where do you think I could get the most bang for indexes (features or results of your blitzindex?)

Right now this is being used against an OLTP system that has some flat tables used for searching.

Was it helpful?

Solution

Index Hoarder is telling you that historically this index is not being used. Therefore, the maintenance of the index is a cost in CPU, I/O, and storage, but you are not getting any performance benefit from those indexes.

A general policy of considering Foreign Keys for indexes is good general plan, but an index that is not used should most likely be dropped.

Here is a link on examining the indexes yourself: http://www.mssqltips.com/sqlservertutorial/256/discovering-unused-indexes/

A snippet of code from that post shows some query details:

SELECT OBJECT_NAME(S.[OBJECT_ID]) AS [OBJECT NAME], 
       I.[NAME] AS [INDEX NAME], 
       USER_SEEKS, 
       USER_SCANS, 
       USER_LOOKUPS, 
       USER_UPDATES 
FROM   SYS.DM_DB_INDEX_USAGE_STATS AS S 
       INNER JOIN SYS.INDEXES AS I ON I.[OBJECT_ID] = S.[OBJECT_ID] AND I.INDEX_ID = S.INDEX_ID 
WHERE  OBJECTPROPERTY(S.[OBJECT_ID],'IsUserTable') = 1
       AND S.database_id = DB_ID()

Consider dropping the unused indexes. If you have a yearly job that would really use the index, consider creating it just for that job.

Feature-Phobic Indexes is suggesting that a filtered index may be more valuable to you than a standard index. A filtered index would only cover the rows that meet your search criteria.

This is a little more speculative, but the advice is to try some filtered indexes. If they do not work for you, you can drop them again.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top