• gosh (11/24/2010)


    I expected proof that there was a performance difference between the order of columns in a composite index or a performance difference in the order of columns in the where-clause.

    You won't find that because the order of columns in a where clause is utterly irrelevant. It makes no difference what order you specify the where clause predicates.

    The order of columns in an index is very important, not so much for a single query, but for when you're trying to get as few indexes as possible to support as many queries as possible.

    Several links to my blog posts on this have already been posted here, so I won't post again. Go and read over them.

    I still think that the title is misleading. Maybe something along the lines: 'Primary Column in a Composite Index is the most Important'.

    It's not. The order of columns (all of them) is important. Maybe the leading column is the most important, but the order of the rest of the columns in the index is important too.

    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