Comparison of MySQL storage engine

Copyright: https://blog.csdn.net/zhydream77/article/details/85321140

InnoDB storage engine, MyISAM storage engine, MEMORY storage engine, Archiv storage engine

InnoDB storage engine

InnoDB transactional database engine of choice, supporting transaction-safe tables (ACID), supports row locking and foreign keys,

InnoDB is the default MySQL engine. InnoDB main features are:

1, InnoDB provides MySQL with a with a commit, rollback, and crash recovery capabilities things safe (ACID compliant) storage engine . InnoDB row-level locking and also provide a SELECT statement similar to Oracle 's non-locking read. These features increase multi-user deployment and performance. In SQL queries, free to InnoDB type tables and other MySQL table types mixed together, even in the same query can also be mixed.

2, InnoDB is designed to handle huge amounts of data designed for maximum performance. Its CPU efficiency is probably any other disk-based relational database engine locks can not match .

3, InnoDB storage engine is fully integrated with MySQL server, InnoDB storage engine to cache data and indexes in main memory and maintains its own buffer pool . InnoDB tables and indexes it in a logical table space, table space can contain a number of files (or original disk file). This is different from MyISAM table, such MyISAM tables each table is stored in separate files. InnoDB tables can be any size, even when the file size is limited to the operating system 2GB.

. 4, the InnoDB supports foreign key integrity constraints, data stored in the table, each table stored in primary key sequence are stored, is not displayed if the primary key is specified at the table definition, InnoDB generates a 6-byte for each row ROWID and use it as the primary key

5, InnoDB is used in many needs on a high-performance large-scale database site

InnoDB does not create directories, use InnoDB, MySQL will create a 10MB size of the automatic extension of the data file named ibdata1 in the MySQL data directory, and named two 5MB size ib_logfile0 and ib_logfile1 a log file

 

MyISAM storage engine

Based on ISAM MyISAM storage engine, and its expansion. It is one of the most commonly used storage engine in the Web, data warehousing and other application environments. MyISAM has a high insert, query speed, but does not support things .

MyISAM main features are:

1, large files (up to 63 file length) are supported on support for large file systems and operating systems

2, when the delete and update operations and the insertion of a mixture, generating a dynamic row size less debris. This block is deleted by combining adjacent to, and if the next block is deleted, it is automatically extended to the lower one

3, each MyISAM table index is the maximum number of 64, which can be changed by recompiling. The maximum number of columns per index is 16

4, the maximum length of the key is 1000 bytes, which may be changed by the compiler, in the case of the key length of over 250 bytes, a more than 1024-byte key will be spend

5, BLOB TEXT columns can be indexed and

6, NULL is permitted in the column of the index, representing the value 0 or 1 byte for each key

7, all numbers in high byte first key is stored to allow a higher index of compression

8, each table has a type MyISAM AUTO_INCREMENT internal column, INSERT and UPDATE operations when the column is updated, while AUTO_INCREMENT column is refreshed. So, AUTO_INCREMENT column type MyISAM table type of update faster than InnoDB AUTO_INCREMENT

9, data files and index files in different directories

10, each character column can have a different character sets

11, there is VARCHAR table length may be fixed or dynamic record

12, VARCHAR and CHAR columns can be up to 64KB

Create a database using the MyISAM engine, will produce three files. Name of the file to the beginning of the table name, at the extension of the file types: Extended frm file stores the table definition, data file name .MYD (MYData), when the extension .MYI index file (MYIndex)

 

MEMORY storage engine

MEMORY storage engine to store data in the table into memory, did not refer to other queries and provides quick access to table data. MEMORY main features are:

1, MEMORY tables each table can have up to 32 indexes, each 16, and the maximum key length of 500 bytes

2, MEMORY storage engine performs the epitome of HASH and BTREE

3, there may be a non-unique key in the table MEMORY

4, MEMORY tables use a fixed length record format

5, MEMORY does not support BLOB or TEXT columns

6, MEMORY support AUTO_INCREMENT index column and the column can contain NULL values ​​of

7, MEMORY table between run by the client share (just like any other non-TEMPORARY table)

8, MEMORY table memory is stored in memory, the memory is inside the table shared MEMORY table and the server is idle during query processing, the creation of

9, when the contents of MEMORY table is no longer needed to free the memory used by MEMORY tables, should be executed DELETE FROM or TRUNCATE TABLE, or delete the entire table (using DROP TABLE)

 

Archiv storage engine

  • Only support insert and select operations (row-level support and the buffer, can achieve high concurrent insertion)
  • Only the self ID column index increases

Archive table than MyISAM tables to be about 75% smaller than InnoDB tables support transactions of less about 83%. When the amount of data is very large Archive insert performance will be better than MyISAM .

Archive table if the performance is likely to exceed MyISAM?

The answer is yes. According to the information MySQL engineers, when the data in the table to reach 1.5GB of this magnitude, CPU and faster time to implement performance Archive table will surpass MyISAM table. Because this time, CPU will replace the I / O subsystem performance bottleneck. Remember table I Archive physical execution than any other type of table / O operation to be small.

Small footprint also play a role when you transplant MySQL data. When you need to move data from one MySQL server to another's, Archive table can be easily ported to new MySQL environment, you only need to save the underlying table to copy files Archive past it.

 

Storage engine of choice

Different storage engines have their own characteristics, to suit different needs, in the following table:

Features

MYISAM

Memory

InnoDB

Archive

Storage Limits

256TB

RAM

64TB

None

Support thing

No

No

Yes

No

Support for full-text indexing

Yes

No

No

No

Support the number of index

Yes

Yes

Yes

No

Support hash indexes

No

Yes

No

No

It supports data caching

No

N/A

Yes

No

Support foreign keys

No

No

Yes

No

If you want to provide commit, rollback, crash recovery capabilities things safe (ACID-compliant) capabilities, and requirements to achieve concurrency control, InnoDB is a good choice.

If a data table queries primarily for inserting and recording, the MyISAM engine can provide high efficiency.

If only temporarily stored data, the amount of data, and does not require high data security, you can choose the data stored in memory Memory engine, MySQL use the engine as a temporary table to store intermediate results of the query.

If only INSERT and SELECT operations, you can choose Archive, Archive for highly concurrent insert operation, but the transaction itself is not safe. Archive ideal for storing archived data, logging information may be used as Archive.

Which requires the flexibility to use the engine, a plurality of database tables may be used in different engines to meet various performance requirements and practical using a suitable storage engine, will improve the performance of the database

Guess you like

Origin blog.csdn.net/zhydream77/article/details/85321140