First, the difference between MyISAM and InnoDB have?
1. InnoDB
support services, MyISAM
are not supported. For InnoDB
each SQL
language by default packaged into the transaction, automatically submitted, it will affect the speed, it is best to multiple SQL
languages on begin
and commit
between the composition of a transaction.
2. InnoDB
support foreign keys, but MyISAM
it does not support. To contain a foreign key InnoDB
table into MYISAM
fail.
3 InnoDB
is an aggregate index, index and data files are tied together, there must be a primary key, the primary key index is very efficient. But it requires two auxiliary index query, the first query to the primary key, and then query the data by primary key. Therefore, the primary key should not be too big because the primary key is too big, the other indexes also will be great. And MyISAM
a non-clustered index, the data file is separated, the index pointer stored in the data file. Primary key index and secondary indexes are independent.
4. The InnoDB
particular number of rows in the table is not stored, the execution select count(*) from table
requires a full table scan. And MyISAM
with a variable to hold the number of rows in the entire table, you only need to read the variable carrying out the above statement, very fast.
5. Innodb
does not support full-text indexing, and MyISAM
support for full-text indexing, the query efficiency MyISAM
is higher.
Second, how to choose the MyISAM and InnoDB?
1. Do you want to support the transaction, if you want to select innodb
, if you do not need to be considered MyISAM
.
2. If the table in the vast majority are just reading queries can be considered MyISAM
, if both read and write quite frequent use InnoDB
.
3. Ben collapse the system, MyISAM
restore it more difficult, can accept.
4. MySQL5.5
versions start Innodb
has become Mysql
the default engine (before that MyISAM
), indicating its advantages are obvious, if you do not know what use it with InnoDB
, at least not worse.
Related Articles Mysql as follows: