Skip to main content

Posts

Showing posts with the label identical duplicate indexes

Find identical duplicate indexes

I realized yesterday I posted this quickly after testing only against SQL 2016 version. So I decided to also test against SQL 2014 and 2012 versions to make sure its compatible.  I made one tweak (removed the compression_delay field from the output) to make it possible.  So please give it a try and let me know your results, perspectives and feedback! As I had mentioned in my original post, I was looking to find identical duplicate non-clustered indexes i.e. indexes on same table with same columns in same order. The query below uses two variables to make it little bit more flexible. If you have a need or just curious to find indexes having same columns but in any order, set value for the variable  @disregard_column_order  =  1 in the code. The query excludes identical indexes where one is clustered and the other one is non-clustered index.  But you can again toggle that by setting value for variable  @include_clustered_indexes = 1. /* whether to i...