Introduction of Four Common Storage Engines in MySQL

 

An introduction to the four engines commonly used in MySQL

(1) MyISAM storage engine

It does not support transactions or 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.

(2) InnoDB storage engine

The storage engine provides transaction safety with commit, rollback, and crash resilience. However, compared to the MyISAM engine, the write processing efficiency will be less, and it will take up more disk space to retain data and indexes. 
Features of the InnoDB storage engine: support for automatic growth columns, support for foreign key constraints

(3)MEMORY storage engine

The Memory storage engine uses what exists in memory to create tables. Each memory table actually corresponds to only one disk file, and 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 shut down, the data in the table will be lost. 
The table of the MEMORY storage engine can choose to use the BTREE index or the HASH index. The two different types of indexes have different usage ranges.

Advantages of Hash index: 
The particularity of Hash index structure, its retrieval efficiency is very high, the retrieval of the index can be located at one time, unlike the B-Tree index, which requires multiple IO accesses from the root node to the branch node, and finally to the page node. , so the query efficiency of Hash index is much higher than that of B-Tree index. 
Disadvantages of Hash index: It is also obvious that inaccurate search, because the hash algorithm is based on equivalent calculation, so it is invalid for "like" and other range search hash indexes, and it is not supported;

The memory type storage engine is mainly used for code tables whose content changes infrequently, or as an intermediate result table for statistical operations, which is convenient for efficiently analyzing the intermediate results and obtaining the final statistical results. Be careful when updating a table whose storage engine is memory, because the data is not actually written to the disk, so you must consider how to obtain the modified data after restarting the service next time.

(4) 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. The merge type table can be queried, updated, and deleted. These operations are actually the internal MyISAM tables. ongoing.

 

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, easy to cache, and easy to recover from failure; the disadvantage is that it usually takes up more space than dynamic tables (because when storing Spaces will be filled according to the width of the column) ps: When fetching data, the spaces behind the fields will be removed by default. If you do not pay attention, the spaces in the data itself will be ignored.

Dynamic table: records are not of fixed length, so the advantage of this storage is that it takes up relatively little space; disadvantages: frequent updates and deletion of data are prone to fragmentation, and you need to execute the OPTIMIZE TABLE or myisamchk-r command regularly to improve performance

Compressed tables: because each record is compressed individually, there is very little access overhead

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325699521&siteId=291194637