SQL question: Does the order of the WHERE clause make a difference?

前端 未结 6 722
谎友^
谎友^ 2020-12-16 11:56

From a performance standpoint, does the order of my SQL WHERE statements make a difference?

For instance

SELECT ... FROM ...
WHERE a > 1
AND b <         


        
6条回答
  •  一整个雨季
    2020-12-16 12:20

    See below and follow the link(long article but worth the read):

    SQL Server Transact-SQL WHERE

    If a WHERE clause includes multiple expressions, there is generally no performance benefit gained by ordering the various expressions in any particular order. This is because the SQL Server Query Optimizer does this for you, saving you the effort. There are a few exceptions to this, which are discussed on this web site. [7.0, 2000, 2005] Added 1-24-2006

提交回复
热议问题