Which performs first WHERE clause or JOIN clause

前端 未结 5 1488
萌比男神i
萌比男神i 2021-02-01 18:47

Which clause performs first in a SELECT statement?

I have a doubt in select query on this basis.

consider the below example

         


        
5条回答
  •  既然无缘
    2021-02-01 18:54

    You can refer MSDN

    The rows selected by a query are filtered first by the FROM clause join conditions, then the WHERE clause search conditions, and then the HAVING clause search conditions. Inner joins can be specified in either the FROM or WHERE clause without affecting the final result.

    You can also use the SET SHOWPLAN_ALL ON before executing your query to show the execution plan of your query so that you can measure the performance difference in the two.

提交回复
热议问题