Does the order of columns in a WHERE clause matter?

前端 未结 7 1636
-上瘾入骨i
-上瘾入骨i 2020-11-28 14:29

Does the order of the columns in a WHERE clause effect performance?

e.g.

Say I put a column that has a higher potential for uniqueness first or visa versa?

相关标签:
7条回答
  • 2020-11-28 14:59

    In the vast majority of cases the query optimizer will determine the most efficient way to select the data you have requested, irrespective of the ordering of the SARGS defined in the WHERE clause.

    The ordering is determined by factors such as the selectivity of the column in question (which SQL Server knows based on statistics) and whether or not indexes can be used.

    0 讨论(0)
提交回复
热议问题