In what order does execution on WHERE and ON clauses work?

后端 未结 4 730
隐瞒了意图╮
隐瞒了意图╮ 2021-01-23 16:41

I was reading this page about APPLY:

http://sqlblog.com/blogs/alexander_kuznetsov/archive/2009/07/07/using-cross-apply-to-optimize-joins-on-between-conditions.aspx

4条回答
  •  囚心锁ツ
    2021-01-23 17:15

    A massive amount of logic, time, blood, sweat, and tears have gone into the SQL Server Engine Optimizer, which is what determines the query plan that determines how a statement is actually processed. What is written in a statement in no way reflects what actually executes in the engine.

    To really see what's going on, run your queries with the show actual query plan option enabled. My guess is that based on the additional where clause the data is being pre-filtered by the optimizer.

提交回复
热议问题