如何查看MySQL的InnoDB生成的B树索引结构?

How to view the B-tree index structure generated by InnoDB of MySQL?

当我们为一个table的属性指定B-tree索引时,有没有办法查看InnoDB生成的B-tree索引结构?

没有官方工具可以查看 InnoDB B 树索引结构的内部结构。

有一组实验性工具可以检查 InnoDB 页面的内部结构,但它不会以人类可读的方式显示 B 树。 https://github.com/jeremycole/innodb_ruby

但我相信您要的是无论如何都不会提供有用信息的东西。

https://dev.mysql.com/doc/refman/8.0/en/innodb-physical-structure.html 说:

With the exception of spatial indexes, InnoDB indexes are B-tree data structures.

使用 InnoDB 时,为索引类型指定 USING BTREE 是多余的。不管你指定与否,它都将是一个 B 树。指定该索引选项时没有区别。

其他存储引擎(MEMORY、NDB)支持 HASH 作为替代索引类型。

https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-storage-engine-index-types