We’ve got through the first three parts of this continued series on the Index Analysis query last week. The previous posts in this complete series are:
- Analyze Your Indexes Part 1 – Combine existing index statistics and missing indexes into a single output
- Analyze Your Indexes Part 2 – Find existing duplicate and overlapping indexes
- Analyze Your Indexes Part 3 – Find the relationship between indexes and foreign keys
- Analyze Your Indexes Part 4 – Add size and current memory utilization
- Analyze Your Indexes Part 5 – Add in index analysis guidelines
- Analyze Your Indexes Part 6 – Add in blocking statistics
- Analyzing Your Indexes with a Custom Report
- Return of Index Analysis Part 1 – Add in data from sys.dm_db_index_operational stats.
- Return of Index Analysis Part 2 – Addition of the pro and con columns.
- Return of Index Analysis Part 3 – Updates to index action column
With the upcoming Minnesota SQL Saturday event, I’ve been a bit preoccupied but finally have the next post in this series ready to go.
A while back when I had been originally working on this query, I had been asked about adding in a column that could be used to script out the query. The column would be able to provide a CREATE or DELETE statement with just a click of the mouse.
That’s what has been added for this update. You will find two new columns at the right edge of the column list as ddl_create and ddl_drop.
These two columns will provide a generic script that should work in many circumstances to create of drop the index on that row. Of course, use your own environment to determine names, file group, fill factor, and etc. for the indexes. And don’t just run out and start building indexes in production.
So without further ado… the script.