FROM or WHERE executed first? | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

FROM or WHERE executed first?

I never really thought about it before, but since you can narrow a recordset in both the FROM and WHERE clauses, it seems that if you make an attempt to limit more in the first clause that is executed, the second clause would have less to do. This is a two part question, first, which clause is evaluated first (or is this dependent on the query) and second, is this correct that narrowing the search more in the first clause to be executed would stand to improve performance?
I believe that you are mentioning limiting the dat in FROM caluse by using JOINS.
In the first place it depends on the query what is executed first, e.g. the subquery is executed before the outer query. Considering a simple query with few joins and where clausse statements, WHERE clause will be executed first to limit the data that will be used in the joins mentioned in the FROM clause. Lesser the data, lesser the processing required to join the tables. So it is always advisble to limit maximum amount of data using WHERE clause. Gaurav