Introduction to MySQL execution engine

table of Contents

MyISAM storage engine

InnoDB storage engine

MEMORY storage engine

MERGE storage engine


 

MyISAM storage engine


Does not support transactions, nor foreign keys, the advantage is that the access speed is fast, there is no requirement for transaction integrity, or applications based on select and insert can basically use this engine to create tables. Support 3 different storage formats, namely: static table; dynamic table; compressed table

  • Static table:

The fields in the table are all non-variable length fields, so that each record is of fixed length. The advantage is that the storage is very fast, it is easy to cache, and it is easy to recover from failures; the disadvantage is that it usually takes up more space than the dynamic table (because the storage will follow the column The width defines the supplementary space) ps: When fetching data, the space behind the field will be removed by default. If you do not pay attention, the space in the data itself will be ignored.

  • Dynamic table:

The record is not of fixed length. The advantage of this storage is that it takes up relatively little space. Disadvantages: frequent updates and deletion of data are prone to fragmentation. You need to periodically execute the OPTIMIZE TABLE or myisamchk-r command to improve performance

  • Compressed table:

Because each record is compressed individually, there is very little access expenditure

 

 

InnoDB storage engine

 

The storage engine provides transaction security with commit, rollback, and crash recovery capabilities. But compared with the MyISAM engine, the write processing efficiency will be worse, and will consume more disk space to retain data and indexes.
Features of InnoDB storage engine: support automatic growth of columns, support for foreign key constraints

 

 

MEMORY storage engine

 

The Memory storage engine uses the content that exists in memory to create tables. Each memory table actually corresponds to only one disk file, the format is .frm. The memory type table access is very fast, because its data is placed in memory, and the HASH index is used by default, but once the service is closed, the data in the table will be lost.

MEMORY storage engine's table can choose to use BTREE index or HASH index, two different types of indexes have different ranges of use

  • Hash index advantages:

The particularity of the Hash index structure, its retrieval efficiency is very high, the index retrieval can be located at a time, unlike the B-Tree index that requires multiple IO accesses from the root node to the branch node, and finally to the page node, so the Hash index The query efficiency is much higher than the B-Tree index.

  • Hash index disadvantages:

It is also obvious that the inaccurate search is because the hash algorithm is calculated based on equivalence, so it is invalid to search for hash indexes such as "like" and so on. It is not supported; the memory type storage engine is mainly used for codes whose content does not change frequently. Table, or as an intermediate result table for statistical operations, to facilitate the efficient analysis of intermediate results and get the final statistical results. Update the table whose memory engine is memory to be careful, because the data is not actually written to the disk, so we must consider how to obtain these modified data after restarting the service next time. 

 

 

MERGE storage engine

 

The Merge storage engine is a combination of a set of MyISAM tables. These MyISAM tables must have the same structure. The merge table itself has no data. You can query, update, and delete the merge type table. These operations are actually on the internal MyISAM table. ongoing.

 

 

 

Published 568 original articles · Like 180 · Visits 180,000+

Guess you like

Origin blog.csdn.net/Delicious_Life/article/details/105616759
Recommended