What is the difference MySQL MyISAM and InnoDB storage engine have?

  First, the difference between MyISAM and InnoDB have?

  1. InnoDBsupport services, MyISAMare not supported. For InnoDBeach SQLlanguage by default packaged into the transaction, automatically submitted, it will affect the speed, it is best to multiple SQLlanguages on beginand commitbetween the composition of a transaction.

  2. InnoDBsupport foreign keys, but MyISAMit does not support. To contain a foreign key InnoDBtable into MYISAMfail.

  3 InnoDBis 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 MyISAMa 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 InnoDBparticular number of rows in the table is not stored, the execution select count(*) from tablerequires a full table scan. And MyISAMwith 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. Innodbdoes not support full-text indexing, and MyISAMsupport for full-text indexing, the query efficiency MyISAMis 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, MyISAMrestore it more difficult, can accept.

    4. MySQL5.5versions start Innodbhas become Mysqlthe 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:

Guess you like

Origin www.cnblogs.com/liuyu2014/p/11904841.html