• steve 96379 - Wednesday, April 4, 2018 7:59 AM

    It actually checks all custom indexes and compares the columns and include columns to ensure that they do not exist in other indexes. 

    Where?

    It's got a distinct on the columns and then a group by on the index create statement, which will  eliminate complete duplicates from being created at the same time, but the missing index feature generally doesn't add complete duplicates to the DMV. It's still able to create near-duplicates (col1, col2 vs col1 include col2) and it doesn't check for already existing duplicates or near duplicates.

    Also, why look at how many scans are on the table that the index is for to see whether to create more indexes on that table, rather than looking at the the estimated improvement % that's in the missing index DMV to determine whether to create the index?  It could end up creating indexes repeatedly on tables that are scanned a lot without looking at what the queries doing the scans are doing. If there are queries with only non-sargable predicates, no amount of indexes created on the tables they scan will stop them from scanning.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass