Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
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: 2499 | Views in the last 30 days: 13
 
Related Articles
FORUM

Is this Index Duplicate

Confusion on index duplication

FORUM

Duplicate column name

Duplicate column name

ARTICLE

Duplicate Indexing Woes

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

FORUM

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...

ARTICLE

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...

Tags
indexing    
miscellaneous    
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones