查看索引
查看表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啊!
参考