SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find Duplicate Indexes

By Jeff Weisbecker,

There are plenty of scripts out there that find duplicate indexes, but they all seem to use cursors.  I didn't want to use a cursor so I ended up creating a few that could handle the duplicates and decided to share this one. 

This will return the table name and the names of the two identical indexes.  If you would like to return indexes with a different number of columns, but the same sequence of columns then comment out the last condition in the SQL statement.  For example, if you would like to return Index #1 as a duplicate of Index #2.

Index #1
  Column 2
  Column 3

Index #2
  Column 2
  Column 3
  Column 4

Total article views: 2621 | Views in the last 30 days: 7
Related Articles

Is this Index Duplicate

Confusion on index duplication


Duplicate column name

Duplicate column name


All INDEX details query - gives duplicate entires

I mixed and matched many queries tto give all details of index needed for analysis. Howeever, the qu...


Duplicate Indexing Woes

Why would you ever create duplicate indexes? Does that even make sense? Steve Jones isn't sure, and ...


Finding and Eliminating Duplicate or Overlapping Indexes

Duplicate & Overlapping Indexes can be a drag on write speed and disk resources. How do we find and...