Does the order of columns in WHERE clause matter?

  • Sorry if this is the most basic of questions. I've searched high & low but I cannot find an answer anywhere...

    I'm wondering if there is a correct order in which the columns should appear in the WHERE clause? Do columns with the most or least matches begin to the left (first column) and continue right?

    Many thanks..

  • bravadortb (1/17/2009)


    I'm wondering if there is a correct order in which the columns should appear in the WHERE clause?

    Not at all. The order that you specify has nothing to do with how SQL will run them.

    http://sqlinthewild.co.za/index.php/2007/07/29/order-of-execution/

    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
  • Awesome, thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply