Blog Post

Return of Index Analysis Part 5

,



Looking for Minifig Monday?
Let’s Anaylze An Index!

Alright, up to the last of the changes I’ve made to the index analysis query that I had planned.  This makes the fifth post in the series on this query. 

The previous posts in this complete series are:

  1. Analyze Your Indexes Part 1 – Combine existing index statistics and missing indexes into a single output
  2. Analyze Your Indexes Part 2 – Find existing duplicate and overlapping indexes
  3. Analyze Your Indexes Part 3 – Find the relationship between indexes and foreign keys
  4. Analyze Your Indexes Part 4 – Add size and current memory utilization
  5. Analyze Your Indexes Part 5 – Add in index analysis guidelines
  6. Analyze Your Indexes Part 6 – Add in blocking statistics
  7. Analyzing Your Indexes with a Custom Report
  8. Return of Index Analysis Part 1 – Add in data from sys.dm_db_index_operational stats.
  9. Return of Index Analysis Part 2 – Addition of the pro and con columns.
  10. Return of Index Analysis Part 3 – Updates to index action column
  11. Return of Index Analysis Part 4 – Added a scripting column for CREATE and DROP.

 

Stored Procedure Wrapper

A while back I was using the index analysis query at a client, I couldn’t find the most recent version of the query.  It can happen when you make a tweak at one client, and then another at a different client.  Soon there were a few versions floating around and the one that is the most “correct” is became harder to identify.

To help prevent this, I had re-written the query as a stored procedure.  That way it can be dropped into the master database.  By being in the master database and having the sp_ prefix, then the procedure can be accessed from any database on the SQL Server instance.

Below are two links that can be used to build the stored procedure.  One for SQL Server 2005 and the other for SQL Server 2008/R2.

sp_IndexAnalysis for SQL Server 2005

sp_IndexAnalysis for SQL Server 2008+

If you have any comments or suggestions, please leave them as a comment.  I consider this a work in progress to help provide a method to get good information on indexes with very little effort.

Related posts:

  1. Return of Index Analysis Part 4
  2. Return of Index Analysis Part 3
  3. Return of Index Analysis Part 2

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating