Compiling DML Statements

When SQL Server compiles an execution plan for a DML statement, it performs the following basic steps:

1. The query is parsed and checked for proper syntax, and the T-SQL statements are parsed into keywords, expressions, operators, and identifiers to generate a query tree. The query tree (sometimes referred to as the sequence tree) is an internal format of the query that SQL Server can operate on. It is essentially the logical steps needed to transform the query into the desired result.

2. The query tree is then normalized and simplified. During normalization, the tables and columns are verified, and the metadata (data types, null properties, index statistics, and so on) about them is retrieved. In addition, any views ...

Get Microsoft® SQL Server 2012 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.