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