- Learn T-SQL Querying
- Pedro Lopes Pam Lahoud
- 294字
- 2021-06-24 14:38:11
Query compilation essentials
The Query Processor is the component inside the SQL Server Database Engine that is responsible for compiling a query. In this section, we will focus on the highlighted sections of the following diagram, which handle query compilation:

The first stage of query processing is generally known as query compilation and includes a series of tasks that will eventually lead to the creation of a query plan. When an incoming T-SQL statement is parsed to perform syntax validations and ensure that it is correct T-SQL, a query hash value representing that statement as it was written is generated. If that query hash is already mapped to a cached query plan, it can just attempt to reuse that plan. However, if a query plan for the incoming query is not already found in the cache, query compilation proceeds with the following tasks:
- Perform binding, which is the process of verifying that the referenced tables and columns exist in the database schema.
- References to a view are replaced with the definition of that view. (This is called expanding the view.)
- Load metadata for the referenced tables and columns:
- The definition of tables, indexes, views, constraints, and so on that apply to the query
- Data distribution statistics on the applicable schema objects
- Verify whether data conversions are required for the query:

If the T-SQL statement is a Data Definition Language (DDL) statement, there's no possible optimization, and so a plan is produced and executed immediately. However, if the T-SQL statement is a Data Manipulation Language (DML) statement, SQL Server will move to an exploratory process known as query optimization.
- 7天精通Dreamweaver CS5網(wǎng)頁設(shè)計(jì)與制作
- VMware Performance and Capacity Management(Second Edition)
- MicroPython Projects
- Python Data Science Essentials
- Photoshop CS3特效處理融會(huì)貫通
- Storm應(yīng)用實(shí)踐:實(shí)時(shí)事務(wù)處理之策略
- Implementing AWS:Design,Build,and Manage your Infrastructure
- 單片機(jī)技術(shù)一學(xué)就會(huì)
- 人工智能:語言智能處理
- 從零開始學(xué)Java Web開發(fā)
- 工業(yè)機(jī)器人入門實(shí)用教程
- 電腦故障排除與維護(hù)終極技巧金典
- Photoshop CS4數(shù)碼照片處理入門、進(jìn)階與提高
- PostgreSQL High Performance Cookbook
- 玩轉(zhuǎn)機(jī)器人:基于Proteus的電路原理仿真(移動(dòng)視頻版)