How the SELECT statement parsed/executed by the SQL Server engine ?

 Posted by PandianS on 11/30/2010 | Category: Sql Server Interview questions | Views: 5622 | Points: 40

When run a SELECT statement, The statement is processed by the various factors

1.The PARSER scans/reads the SELECT statement and splits it into some logical units such.
i.e: keywords/reserved word, operators, expressions and identifiers.

2. SEQUENCE TREE or QUERY TREE is built the logical steps needed to transform the source data into the format as needed by the end result.

3. The QUERY OPRIMIZER analyzes the query in various ways and selects the series of steps that returns the end results fastest way. The query tree is updated to record this exact series of steps. The final, optimized version of the query tree is called the execution plan.

4. The RELATIONAL ENGINE starts executing the execution plan which was prepared by the Query Optimizer.

5.The RELATIONAL ENGINE requests the STORAGE ENGINE pass up data from the rowsets requested.

6. The RELATIONAL ENGINE processes the data returned from the storage engine to the client.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Posted by: Raja on: 12/1/2010 | Points: 10
I can say, its a very good post PandianS. I think everyone knows about SELECT statement in SQL Server but hardly people know how it executes. Thank you very much for sharing !

Login to post response