Simple parsing of SQL Server principles

Source: Internet
Author: User

(1) Client SQL Server network interface through a network protocol (can be shared memory: simple high-speed, the client and SQL Server in the same computer default connection mode; TCP/IP: Access to SQL Server is the most common protocol, The client specifies the IP address and port number to connect to SQL Server; Named pipes: Named Pipes and TCP/IP protocols are architecture-similar, designed for LAN, and slower in WAN; VIA: Virtual Interface Adapter is a protocol that enables high-performance communication between two systems. Requires that both ends of the communication use special hardware and a dedicated connection) and the service of SNI establishes a connection, and then creates a connection over the network protocol connection and TDS port, and through this connection wants SQL Server to send the SELECT statement in the form of TDS messages.

(2) The SNI of SQL Server unpack the TDS message, read the SELECT statement, and send the SQL command to the command parser.

(3) The command parser checks the buffer pool's plan cache for a query plan that matches the received statement, and if not, the command resolver generates a query tree based on the SELECT statement and then passes the query tree to the query optimizer to generate a query plan.

(4) Because this query command is very simple, the query optimizer simply generates a "0 overhead" query plan (the "normal query plan") during the pre-optimization phase, which the query optimizer sends to the query executor for execution.

(5) When executing a query plan, the query executor first determines what data needs to be read to complete the query plan, and then sends access data requests through the OLE DB interface to the access method in the storage engine.

(6) In order to complete the query executor request, the access method needs to read a data page from the database, and requires the buffer Manager to provide this data page.

(7) The Buffer Manager checks to see if the data page exists in the data cache, and if the page does not exist in the data cache, the Buffer manager first fetches the data page from the disk, caches it, and passes it back to the access method.

(8) Finally, the access method passes the result set to the relational engine, which sends the result set to the client by the relational engine.

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.