MySQL 使用的是 BTree 还是 B+Tree
MySQL B树 B+树 About 1,192 words查看索引
查看表account的索引。
show index from account;
输出:
mysql> show index from account;
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| account | 0 | PRIMARY | 1 | id | A | 3 | NULL | NULL | | BTREE | | |
+---------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
1 row in set (0.00 sec)
为什么是 BTREE
Index_type上显示的虽然是BTREE,但MySQL底层确实是用的B+Tree,外国友人猜测的可能原因:
B+TREE不是一个很好的关键词,+号是一个操作符。- 语法比
InnoDB还早,可能比ISAM还早。
注意
B+Tree也是一种BTree啊!
参考
https://dba.stackexchange.com/questions/204561/does-mysql-use-b-tree-btree-or-both/204573
https://blog.jcole.us/2013/01/10/btree-index-structures-in-innodb
Views: 4,030 · Posted: 2021-03-10
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...