Get the App
SLTechnology News&Howtos  ›  Database  › 

How the Mysql database executes sql statements

Shulou Source: shulou.com Published: 2022-06-01 19:54:01 10月24日 Update

The following mainly brings you how Mysql database executes sql statements. I hope these words can bring you practical use. This is also the main purpose of this article that I edit Mysql database how to execute sql statements. All right, don't talk too much nonsense, let's just read the following.

MySQL logical architecture

You must have heard the saying, "Mysql is a plug-in storage engine." So what is a plug-in storage engine? Let's first take a look at the overall architecture of Mysql.

As can be seen from the above figure, mysql is made up of the following components.

Client:

Strictly speaking, different people may have different understandings of whether the client is the content of the entire architecture. I personally understand that it should be included, or that is to say, the entire architecture of mysql must include the output interface, and the client is the implementation of this interface. Core services:

This contains a lot of content, generally speaking, there are the following parts:

1) connection pooling components: manage caching requirements such as buffering user connections, threading, etc.

2) manage services and tool components

3) sql interface component: accepts the user's SQL command and returns the results that the user needs to query

4) query Analyzer component: the SQL command is validated and parsed by the parser when it is passed to the parser

5) Optimizer components: optimize incoming SQL

6) caching component; Storage engine:

Here is what we call plug-in storage engine, you can choose InnoDB,MyISAM,NDB and so on; physical files:

The database corresponds to the underlying data file

The execution process of MySQL:

You can use the following figure to explain how sql is executed.

1.Mysql client establishes communication with Mysql CVM

two。 Query whether there is a cache of results in the cache, if so, return it directly; if not, you need to create a new query

3.sql syntax parsing

4. Optimize sql

5. The optimized sql is handed over to the storage engine, which executes and returns the result.

6. The cache module records the results and returns data.

For the above about how the Mysql database executes sql statements, we do not think it is very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.

Tags: Data engine component storage cache database content customer client architecture results query statement interface plug-in user service different below system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Apple Shulou Tech Info Linux vpn MariaDB