mysql-- secondary index (secondary indexes)

Secondary index: primary key value stored in the leaf node, each time the data lookup, to find the index keys of leaf nodes main, to give clustered index data according to a complete row of primary key values.

problem:

1. Compared to the leaf node is stored in the row pointer, secondary index stores the primary key value will take up more space, why should such a design?

InnoDB moving rows, secondary index maintenance, because the leaf node is stored in the primary key, rather than a pointer.

2. Then InnoDB has a clustered index, why have secondary indexes do?

Clustered index the leaf node stores a complete row of data, but stores only two primary key index, compared to the clustered index occupies less space. When we need to create multiple indexes for the table, if we are all clustered index, it will take up a lot of memory space, so InnoDB established in the primary key is the clustered index, the only index, the general index, the index prefix and so are two level of the index.

Guess you like

Origin www.cnblogs.com/gaoquanquan/p/11030999.html