Mysql difference in what the MyISAM and InnoDB

the difference:

1. InnoDB supports transactions, MyISAM does not support InnoDB for each SQL language are packaged into the transaction default, auto-commit, this will affect the speed, it is best to place multiple SQL language between begin and commit, constitute a single transaction;

2. InnoDB supports foreign keys, and MyISAM does not support. For a table that contains InnoDB foreign keys 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. Whereas non-aggregated MyISAM index, separate data file, the index pointer stored in the data file. Primary key index and secondary indexes are independent.

4. InnoDB specific number of rows of the table is not saved, performs select count (*) requires a full table scan from table. And MyISAM with a variable number of lines to save the whole table, only when executing the read statement to the variable, fast;

5. Innodb does not support full-text indexing, and MyISAM supports full-text indexing, query on MyISAM higher efficiency;

 

how to choose:

1. Do you want to support the transaction, if you want to select innodb, if you do not consider MyISAM;

2. If the table in the vast majority are just reading queries can be considered MyISAM, if both read and write quite frequently, use InnoDB.

3. System Ben collapse, MyISAM recover more difficult, they can accept;

4. MySQL5.5 start Innodb version has become the default engine Mysql (before a MyISAM), explain its advantages are obvious, if you do not know what use, then use InnoDB, at least not worse.

Author: Oscarwin
link: https: //www.zhihu.com/question/20596402/answer/211492971
Source: know almost

Guess you like

Origin blog.csdn.net/weberhuangxingbo/article/details/91045983