MySQL Advanced (1) Introduction to the MySQL Architecture Hierarchy Engine Comparison Differences between MyISAM and InnoDB

MySQL Advanced (1) Introduction to MySQL Architecture Hierarchy

​ mysql uses a plug-in storage engine architecture to separate query processing from other system tasks and data storage and extraction.

1. MySQL hierarchy:

​ Before optimizing mysql, you need to have a certain understanding of the mysql hierarchy. When a problem occurs (long waiting time and long query time), you can better locate the problem.

Insert picture description here

  1. Connection layer

    ​ The uppermost connection layer provides some client connection services, including local socks communication and most of the tcp/ip-like communication based on client/server tools. Just complete some similar connection processing, authorization authentication and related security programs. In this layer, the concept of connection pool is introduced to provide threads for clients who pass authentication and secure access. At the same level, SSL-based secure links can be implemented.

  2. Service layer

    ​ The second layer architecture mainly completes most of the core service functions, such as SQL interface, and completes cache query, SQL analysis and optimization, and the execution of some built-in functions. There are also cross-storage engine functions that are also implemented at this layer, such as procedures and functions. At this layer, the server will parse the query and create a corresponding internal parse tree, and complete corresponding optimizations such as determining the order of the query table, whether to use the index, etc., and finally generate the corresponding execution operation. If it is a select statement, the server will also query the internal cache. If the cache space is large enough, the performance of the system can be well prompted in an environment that solves a large number of read operations.

  3. Engine layer

    ​ Storage engine layer. The storage engine is really responsible for the storage and extraction of data in MySQL. The server communicates with the storage engine through API. Different storage engines have different focuses and functions, so we can choose them according to our actual needs. Mainstream engines MyISAM and InnoDB

  4. Storage layer

    ​ The data storage layer mainly stores data on the file system running on the bare device and completes the interaction with the storage engine.

2. The difference between MyISAM and InnoDB

Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44634197/article/details/108902522
Recommended