B + Tree Index
In the database, the height of the B + tree is generally 2 ~ Layer 3, that is, for the row record of a key value, it only needs 2 to 3 times of IO at most.
The InnoDB Storage engine table is an index organization table, that is, the table data is stored in the order of primary keys. The clustered index constructs a B + tree based on the primary key of each table, and the leaf node stores the row record data of the entire table. Therefore, it also makes the leaf node of the clustered index A data page. This feature of clustered index determines that the data in the index organization table is also part of the index. Like the B + tree structure, each data page is linked through a two-way linked list.
Another benefit of clustered index is that its primary key sorting and range searching are very fast.
Secondary index: leaf nodes do not contain all data of rows. In addition to the key value, each leaf-level index row also contains a bookmarkdonet that tells the InnoDB Storage engine where data corresponding to the index can be found.