编程知识 cdmana.com

Basic structure of MySQL

image

The connector

The connector is responsible for establishing a connection with the client , Access permissions , Maintaining and managing connections

1. User password authentication
2. Query permission information , Assign appropriate permissions
3. have access to show processlist Check out the current connection
4. If you haven't used it for too long , Will automatically disconnect , adopt wait_timeout control , Default 8 Hours

Connection can be divided into long connection and short connection

The query cache

When executing a query statement , Will go to the query cache to see the results first , Previously executed sql The sentence and its result are as follows key-value Stored in the cache in the form of , If you can find it, go straight back to , If you can't find it , Just go on to the next stage

But query caching is not recommended

1. Query cache failures are frequent , As long as the table is updated , The cache will empty
2. The data hit rate of cache corresponding update is relatively low

analyzer

1. Lexical analysis :Mysql The input string needs to be identified. What does each part mean . such as : Put the string T Identify as table name T, Put the string ID Identify as column name ID.
2. Syntax analysis : According to the rules of grammar sql Is it satisfactory? Mysql grammar , If it doesn't, it will be reported as wrong .

Optimizer

1. In the specific implementation sql The statement before , We need to process the optimizer first , such as : When there are multiple indexes in the table , Decide which index to use , When sql Statement needs to do multiple table Association , Determine the order in which tables are linked .
2. Different ways of execution are to sql The execution efficiency of statements has a great influence
RBO: Rule based optimization
CBO: Cost based optimization

actuator

Operate the engine , Return results

Storage engine

Store the data , Provide read-write interface
image

版权声明
本文为[MackingJay]所创,转载请带上原文链接,感谢
https://cdmana.com/2020/12/20201224214843978x.html

Scroll to Top