• websites2 (6/29/2009)


    Am I right in thinking that 5 indexes with 4 columns covering popular queries is better than 10 indexes each on a single column?

    In general, yes. The majority of the time, SQL will only use one index per table for a query, if there are three conditions in the where and 3 single column indexes, it's likely going to use the most selective, then look up to the clustered index, then filter on the other two conditions.

    I wrote a blog post about index columns. It doesn't cover exactly this question, but it might help.

    http://sqlinthewild.co.za/index.php/2009/01/19/index-columns-selectivity-and-equality-predicates/

    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