SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


The Ultimate Index Usage Reporter


The Ultimate Index Usage Reporter

Author
Message
YeshuaAgapao
YeshuaAgapao
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1021 Visits: 211
Comments posted to this topic are about the item The Ultimate Index Usage Reporter



David Kranes
David Kranes
SSC Veteran
SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)

Group: General Forum Members
Points: 255 Visits: 347
This is nice! Could you please provide a description of what the following columns mean:

user_seeks
system_seeks
user_scans
system_scans
user_lookups
system_looksups
user_updates
system_updates
score

What should I bee looking for here? What red flags should I look for?

Also, the index_columns_include never has any columns in it.

Best Regards,

~David
YeshuaAgapao
YeshuaAgapao
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1021 Visits: 211
user_* is anything initiated by the user

system_* is anything initiated by the server - statistics updates etc...

Seeks are seek operations (index seek, clustered index seek)

Scans are scan operations (index scan clustered index scan)

Lookups are only applicable to clustered indexes. They are bookmark lookups caused by when the nonclustered index not containing (seek or include) all the columns in the query (SELECT columns, JOIN predicates, WHERE predicates, ORDER BY columns). The SSMS built-in report do not report lookups.

The score in general is (seeks*10+scans+1)/(updates+1). Clustered indexes don't get penalized for updates since every table should have one, but if a nonclustered index has a higher score, you should consider changing your clustered index. Higher scores mean useful indexes, low scores mean indexes that cause more overhead than benefit. Scanning cost isn't taken into account - it is just usage vs maintenance. But a score below 0.0001 is almost for certain a useless index.

If your index_columns_include is always blank, then none 0f your indexes have include coluimns. Include columns are available for covering the query, but not for seeks - they are leaf level only. CREATE INDEX IX_table_seekcolumns_includecolumns ON dbo.table (Seek Columns) INCLUDE (Include Columns)



David Kranes
David Kranes
SSC Veteran
SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)SSC Veteran (255 reputation)

Group: General Forum Members
Points: 255 Visits: 347
Thank you for the explanation. That helps a lot. Smile

-David

Best Regards,

~David
Greg Drake
Greg Drake
Mr or Mrs. 500
Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)Mr or Mrs. 500 (575 reputation)

Group: General Forum Members
Points: 575 Visits: 536
This is a nice script. I have a similar one I have been using and I made some improvements based on what you did. Thanks for sharing.

One thing to note: your ORDER BY clause very complex. When I ran this on a small VM it choked and literally told me the query was too hard (not enough memory, I think). I chopped off the ORDER BY and it worked fine. For me this doesn't matter because I copy the results into a spreadsheet and do my analysis there.

I don't really understand your "score" column. Is it to show the indexes that are most important?

I recently ran across the following article with scripts from Jason Strate that also deal with analyzing indexes, but he has taken it to a whole other level.
http://www.sqlservercentral.com/blogs/stratesql/2012/12/18/index-analysis-the-re-return/
Iwas Bornready
Iwas Bornready
SSCoach
SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)SSCoach (16K reputation)

Group: General Forum Members
Points: 16042 Visits: 885
Thanks for the script.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search