Current location - Loan Platform Complete Network - Big data management - How to understand the two common MySQL storage engines: MyISAM and InnoDB?
How to understand the two common MySQL storage engines: MyISAM and InnoDB?
InnoDB Engine: The InnoDB engine provides support for database acid transactions and also provides row-level locks and foreign key constraints, and is designed to handle large data volume database systems. when MySQL is running, InnoDB creates a buffer pool in memory for buffering data and indexes. However, the engine does not support full-text search and is slow to start up. It does not store the number of rows in the table, so when the select count() from table command is performed, the entire table needs to be scanned. Because of the small granularity of the lock, write operations do not lock the entire table, so it will be more efficient to use it in scenarios with a high degree of concurrency.

MyIASM engine: MySQL's default engine does not provide transaction support, nor does it support row-level locks and foreign keys. Therefore, when performing insert and update statements, i.e., when performing write operations, you need to lock the table, so it will result in lower efficiency. However, unlike InnoDB, the MyIASM engine saves the number of rows in the table, so when a select count() from table statement is performed, it is possible to read the saved values directly without scanning the entire table. So, if there are many more reads than writes to a table, and you don't need transaction support, you can use MyIASM as your database engine of choice.

MyISAM is the default database engine for MySQL (prior to version 5.5). Although it had excellent performance and offered a large number of features, including full-text indexing, compression, spatial functions, and so on, MyISAM did not support transactions or row-level locking, and its biggest drawback was that it could not be safely recovered from a crash. However, after version 5.5, MySQL introduced InnoDB (the transactional database engine), and the default storage engine after MySQL version 5.5 is InnoDB.

Most of the time, we use the InnoDB storage engine, but there are some situations where MyISAM is appropriate, such as read-intensive situations.