O'Reilly logo

Microsoft® SQL Server 2012 Unleashed by Alex T. Silverstein, Chris Gallelli, Paul T. Bertucci, Ray Rankins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Query Compilation and Optimization

Query compilation is the complete process from the submission of a query to its actual execution. There are many steps involved in query compilation—one of which is optimization. All T-SQL statements are compiled, but not all are optimized. Primarily, only the standard SQL Data Manipulation Language (DML) statements—SELECT, INSERT, UPDATE, and DELETE—require optimization. The other procedural constructs in T-SQL (IF, WHILE, local variables, and so on) are compiled as procedural logic but do not require optimization. DML statements are set-oriented requests that the Query Optimizer must translate into procedural code that can be executed efficiently to return the desired results.

Note

SQL Server also optimizes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required