Which SQL query is faster? Filter on Join criteria or Where clause?

前端 未结 9 1006
伪装坚强ぢ
伪装坚强ぢ 2020-11-27 03:36

Compare these 2 queries. Is it faster to put the filter on the join criteria or in the WHERE clause. I have always felt that it is faster on the join criteria b

9条回答
  •  甜味超标
    2020-11-27 04:17

    Rule #0: Run some benchmarks and see! The only way to really tell which will be faster is to try it. These types of benchmarks are very easy to perform using the SQL profiler.

    Also, examine the execution plan for the query written with a JOIN and with a WHERE clause to see what differences stand out.

    Finally, as others have said, these two should be treated identically by any decent optimizer, including the one built into SQL Server.

提交回复
热议问题