SQL Server: Script to find Redundant and Duplicate Indexes

In this post, I am going to share one T-SQL script to find duplicate and redundant Indexes of the SQL Server.

I have found some of the junior and intermediate Database Developers, who are creating multiple duplicates indexes which are decreasing the overall performance of the database.

Now the job of the Database Administrator is to find and remove duplicate indexes from the database.

I have prepared a small demonstration by creating some of duplicate indexes and provided script to find that duplicate indexes.

First, create a sample table:

Create duplicate indexes on LastName column:

Sample SELECT statements:
Below, both SELECT statements are using only one index (idx_tbl_Students_LastName_FirstName_DOB) because LastName column is duplicated in all the indexes.

Script to find Duplicate Indexes:

The Result:

SQL Server Duplicate Index

Anvesh Patel

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz