MyISAM and InnoDB index difference

First of all you need to know;

Whether Myisam and Innodb engine, defines a row if the construction of the table when the primary key column does not show it, he will be automatically created inside a hidden primary key index;

Index than the primary key index is assumed called secondary index; Myisam and first two are the default btree index Innodb employed, can make a binary brain;

Myisam engine data on the physical disk is stored in the order, and the table data innodb engine is randomly distributed;


The leaf nodes of the primary key index myisam only pointer data stored on the physical disk, the other secondary index is the same;

Leaf node innodb primary key index data stored directly below, other sub-leaf node index to the primary key ID;

It can dig out a problem, that is a big if Innodb data columns, such as varchar (300), which are more, then sort by the primary key id when ordering will be slower, because

id primary key placed below all data columns, and Myisam do not need to scan data columns, this problem can be solved and to build a primary key id with the joint index words;


Index covering the back row:

If you are looking for the data happens to be the index column, then do not go on to the data in the physical disk is no return, called an index covering;

Queries like covering indexes examples





Guess you like

Origin www.cnblogs.com/hualou/p/12071090.html