The difference between the storage engine InnoDB and MyISAM

storage engine


1. Summary
name MyISAM InnoDB
affairs not support support
foreign key not support support
data row locking not support support
data table lock support support
full text index support not support
Advantage Many query operations Many modification operations
Compared High performance and fast execution Support for transactional foreign keys
count(*) Read the number of lines in memory full table scan
count(*) where no difference no difference
application (1) Do a lot of count calculations; (2) Inserts are infrequent, and queries are very frequent; (3) No transactions (1) The reliability requirements are relatively high, or transactions are required; (2) Table updates and queries are quite frequent, and the chance of row locking is relatively large


2. Others

1. Count(*) without where is much faster than InnoDB using MyISAM. Because MyISAM has a built-in counter, it reads directly from the counter when count(*), and InnoDB must scan the whole table. Therefore, when executing count(*) on InnoDB, it is generally accompanied by where, and where contains index columns other than the primary key. Why is there special emphasis on "other than the primary key"? Because the primary index in InnoDB is stored with the raw data, and the secondary index is stored separately, and then there is a pointer to the primary key. So if it is just count(*), the secondary index scan is faster, and the primary key is mainly used to scan the index and return raw data.

2. Provide row lock (locking on row level), provide the same type as Oracle Non-locking read in SELECTs, in addition, the row lock of InnoDB table is not absolute, if MySQL cannot determine the range to be scanned when executing a SQL statement, InnoDB table will also lock the whole table, for example update table set num=1 where name like "%aaa%"




Blog reference:
The difference between MyISAM and InnoDB

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326641525&siteId=291194637