Wednesday, December 15, 2010

Execution Plan of query in sql server

When you submit a query sql server what steps it process?

First query is process in relational engine then execution plan which is generated is executed in storage engine

Plan is generated in binary format non readable
  1. FROM clause
  2. WHERE clause
  3. GROUP BY clause
  4. HAVING clause
  5. SELECT clause
  6. ORDER BY clause
Plans are generated for DML statements
FROM: First it will come into from clause that time only if you exclude the rows by using ON conditions then in the second phase it will come into where clause that time less rows will be there to process 

WHERE: When query will be in where clause at that time will remove unwanted rows and then they are grouped 

and then it will carry on with select part project the columns and will order by in proper sequence if mentioned

No comments:

Post a Comment