Tracking Index Usage Like a Pro Ed Pollack Sr. Database Administrator Datto
Agenda Understanding Index Usage to Optimize Performance: Introduction. Quick review of indexes. Index usage stats tracking & demo. Missing index usage tracking & demo. Conclusion. Questions!? Where to find me.
Introduction (aka: why are we here?) Indexes are key to query performance. No index = slow, inefficient performance*. *Assuming that is not what you want. Too many indexes waste space and slow down writes. System views are available to track usage. System views are available to track missing indexes.
Quick Index Review Indexes are structures that organize data and optimize it for specific types of queries. Indexes speed up reads that use them effectively (seeks). Indexes slow down writes when they need updating. Indexes consume disk space and require maintenance. TableClustered IndexNonclustered Indexes Also: Columnstore (CI & NCI), XML, Spatial, Hash.
Why Do We Want This? Improve performance/optimize before trouble strikes! 3rd party tools for this purpose typically are… expensive not very customizable bundled with stuff you don’t want/need not able to handle your use-case It’s free! You can alter/use it however you want.
Index Usage Statistics Demo
Missing Index Statistics Demo
Other Thoughts Index usage implies app usage. Changes in one mean changes in the other! Missing indexes imply new/changed queries or stats. Check index stats following a release! Code like this is heavily customizable. Make it fit your environment. Generate metrics, report on usage, and automate it!
Conclusion Indexes are critical to performance. Tracking usage long-term is the only way to fully understand indexing usage and needs. Schedule jobs/tasks to regularly collect this data. Usage metrics teaches us how an app works. Use these metrics to prevent performance nightmares!
Questions???
Contact Info & Links Ed Pollack ed7@alum.rpi.edu @EdwardPollack SQL Shack SQL Server Central SQL Saturday Albany (2018) Thank you!!!