当前位置:网站首页>struct MySQL

struct MySQL

2022-07-05 12:16:00 The king of early rising

First, start with the structure , Then analyze the execution process in terms of query and update operations

MySQL Structure

MySQL Its structure is divided into two layers :

Sever Layers and storage engines . This paper aims at InnoDB Engine to analyze .

Sever layer

The connector

The function of the connector is to detect login .

Check the account and password , Then check the permissions of the user . As the authority basis for all subsequent operations of the user .

Be careful : After modifying the permission of a user , You need to reconnect to take effect . Such as continuous disconnection , Permissions are still old .

The query cache

stay MySQL8.0 Remove later .

Follow cpu Caching is similar , When executing a statement , First, look in the cache , If you find it , Just operate in the cache , Synchronize updates to the database . Changes to the database will also be updated in the cache , To ensure consistency .

Why not , Because in practice ,MySQL Cache invalidation is very frequent . Later, it was no longer used .

analyzer

The analyzer has two steps , To check whether the statement is reasonable , And what the sentence does .

  1. Lexical check . This step will check the keywords in the statement , Include table name 、 Name 、select、 Query conditions, etc .
  2. Syntax check . Check whether the sentence conforms to the grammar .

Optimizer

The optimizer is to make MySQL Execute in the best way he thinks . For example, how to select indexes when there are multiple indexes , How to select Association order when querying multiple tables .

After the optimizer , One SQL How to execute the statement , It's all set .

actuator

First step : Verify user rights , That is, the user permissions queried by the connector are used .

If not, an error message will be returned , If permission permits , Then call the interface of the engine , Returns the result of the interface execution .

Keep early hours , take care . The king of early rising wishes you good luck !

原网站

版权声明
本文为[The king of early rising]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140531327520.html