Chapter 2 Selection of table type (storage engine)
2.1 Overview of Mysql storage engine
Mysql supports multiple storage engines. When dealing with different types of applications, you can choose to use different storage engines to improve the efficiency of the application or provide flexibility of storage.
The storage engines of mysql include: MyISAM, InnoDB, BDB, MEMORY, MERGE, EXAMPLE, NDB Cluster, ARCHIVE, CSV, BLACKHOLE, FEDERATED, etc. Among them, InnoDB and BDB provide transaction safety tables, and other storage engines are non-transaction safety tables.
2.2 Characteristics of various storage engines
Below we focus on introducing several commonly used storage engines and compare the differences and recommended usage of each storage engine.
The 2 most commonly used storage engines:
1. Myisam is the default storage engine of Mysql. When create creates a new table and the storage engine of the new table is not specified, Myisam is used by default.
Each MyISAM is stored as three files on disk. The file names are the same as the table names, and the extensions are .frm (storing table definition), .MYD (MYData, storing data), and .MYI (MYIndex, storing index). Data files and index files can be placed in different directories to evenly distribute IO and obtain faster speeds.
2. InnoDB storage engine provides transaction security with commit, rollback and crash recovery capabilities. However, compared to Myisam's storage engine, InnoDB's write processing efficiency is less efficient and takes up more disk space to retain data and indexes.
The above is the overview of Mysql storage engine. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!