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

Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.

If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.

I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.

More from dbrnd.com

Leave a Reply

Be the First to Comment!

Notify of