Wednesday, July 4, 2012

Order of Query Execution in Microsoft SQL Server


SQL query is excuted in following order.

The query goes to the shared pool that has information like parse tree and execution plan for the corresponding statement. Then validates the SQL statement and validates the source(table).
Acquire locks.
Checks all the privileges.
Execute the query.
Fetch the values for SELECT statement
Displays the fetched values.
To sum up, the sequence is:
SELECT
FROM
WHERE
GROUP BY
HAVING 


No comments:

Post a Comment