SQL Server Execution Plan

Source: Internet
Author: User

What happens when a query is submitted?

When you submit a query to SQL Server, many processes on the sever start working on the query. The goal of these processes is to manage this system so that the query can select, INSERT, UPDATE, and delete data.

Each time a query is submitted to the system, the processes start moving (kick into action). Although there are many different activities occurring in SQL Server at the same time, we will focus on the processes that surround the query. The process used to meet the query requirements can be roughly divided into two stages: 1. Processes that occur in the relational engine 2. Processes that occur in the storage engine

In the relational engine, the query is parsed syntactically and then used to generate the execution plan for the query optimizer processing. The plan is sent in binary form to the storage engine, which acquires or modifies the underlying data (underlying) based on the execution plan. The storage engine is where locks, index maintenance, transactions, and so on occur. Since the execution plan is created in the relational engine, the relational engine is where we are primarily concerned.

Query parsing when we hand over the query to the SQL Server system, the first place it arrives is the relational engine. When the query arrives, it is handed to a process to check if the T-SQL is correct and the format is true. This process is querying the parsing process (query parsing). If the query does not parse correctly, such as when you write a select as Seletc, the parse stops and returns an error to the query source. The output of the parsing process is a syntax tree (parse tree) or query tree, which can even be called a sequence tree (sequence trees). This syntax tree represents the logical steps necessary to execute a query request.

If the T-SQL text (string) is not a data manipulation language (DML) declaration, but a data definition language (DDL) query, it will not be optimized. One reason is that there is only one correct way to create a table for SQL Server. Therefore, there is no chance to improve performance for this statement.

SQL Server Execution Plan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.