mysql database | brief description of database engine

Mysql common engine

Refer to the article by @SileeLiu , the content of this article is relatively concise and short, for details, please refer to

1. Engine Type

View the engine used by the MySQL database

SHOW ENGINES;

Check which engine the database uses by default

SHOW VARIABLES LIKE 'storage_engine';

Insert picture description here

1.1 InnoDB

InnoDB is MySQL's default storage engine. InnoDB is also the preferred engine for transactional databases. It supports transaction security tables (ACID), row locking and foreign keys. As you can see in the figure above, InnoDB is the default MySQL engine.
The main features of InnoDB are:

  1. Support affairs
  2. Support foreign keys
  3. Support clustered index
  4. The minimum lock granularity is row lock
  5. The local storage data files are .frm and .data

1.2 MyISAM

MyISAM is based on the ISAM storage engine and extends it. It is one of the most commonly used storage engines in the Web, data warehousing, and other application environments. MyISAM has high insertion and query speed , but it does not support things or foreign keys;

1.3 MEMORY

The MEMORY storage engine stores the data in the table in memory, providing fast access for querying and referencing other table data.

The intermediate table in Mysql uses the Memory engine, so one of the database optimizations is尽量和用联合索引代替中间表

1.4 Archive

Temporarily

1.5 Selection of Storage Engine

Different storage engines have their own characteristics to meet different needs, as shown in the following table:
Insert picture description here

  1. If you want to provide transaction security (ACID compatible) capabilities such as commit, rollback, and crash recovery capabilities, and require concurrency control, InnoDB is a good choice
  2. If the data table is mainly used to insert and query records, the MyISAM engine can provide higher processing efficiency
  3. If the data is only temporarily stored, the amount of data is not large, and high data security is not required, you can choose the Memory engine that stores the data in memory, and MySQL uses this engine as a temporary table to store the intermediate results of the query
  4. If you only have INSERT and SELECT operations, you can choose Archive. Archive supports highly concurrent insert operations, but it is not transaction safe. Archive is very suitable for storing archived data, such as recording log information can use Archive

Guess you like

Origin blog.csdn.net/weixin_40597409/article/details/115269776