Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the stages of the execution process of the MariaDB server query

Shulou Source: shulou.com Published: 2022-05-31 15:56:29 10月03日 Update

This article mainly shows you "what are the stages of the MariaDB server query execution process", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the stages of the MariaDB server query execution process" this article.

In the MariaDB server, the execution of the query is roughly divided into the following three stages:

(1)。 Receive the SQL statement from the user, segment the statement and analyze the lexical syntax, and finally generate a parsing tree that the MariaDB server can understand.

(2)。 Confirm the parsing information of the SQL statement, choose which data table to read from, and which index to use to read the data table

(3)。 Get data from the storage engine with the order of reading the table or the selected index determined in step 2.

The first phase, often referred to as SQL parsing, is handled by the SQL parser of the MariaDB server. If there is a syntax error in the SQL statement, it can be detected at this stage. After SQL parsing, the SQL parsing tree is finally formed. The MariaDB server uses the SQL parse tree instead of the SQL statement itself to execute the query.

The second phase processes the following based on the SQL parsing tree formed in the first phase:

(1)。 Remove unnecessary conditions and simplify the compound operation.

(2)。 If there is a multi-table join, determine the reading order.

(3)。 Determine the index to use based on the conditions and index statistics used for each data table.

(4)。 Put the acquired record into a temporary table to determine whether it needs to be processed again.

The third phase will request reading records from the depositor engine according to the execution plan, and the MariaDB engine will connect, sort and so on the records obtained from the storage engine.

These are all the contents of this article entitled "what are the stages of the MariaDB server query execution process?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Stages servers services queries statements procedures content engines data indexes datasheets articles processing information conditions syntax order storage learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn NVidia Shulou Information Shulou Technology Shulou Tech Info