MySQL Information_schema index_length

MySQL Information_schema index_length

问题描述:

我检查了有关我的mysql数据库的信息,发现仅在primary_key列上具有索引的表的index_length为0.其他具有外键和索引的表的index_length具有值.为什么会这样?

I checked information about my mysql database, and found, that index_length on tables, that have index only on primary_key column is 0. Index_length of other tables, that have foreign keys and indexes on them has value. Why is it so?

更新:感谢您的帮助,这里也给出了很好的答案:

UPDATE: Thanks for help, also nice answer given here: How to find out size of indexes in mysql (including primary keys)

表类型为InnoDB.InnoDB将数据存储在主键(索引组织表)中.因此,主键已经在DATA_LENGTH中进行了计算.INDEX_LENGTH表示所有二级索引的大小".

The table type is InnoDB. InnoDB stores the data in the primary key (index-organized table). So the primary key is already accounted in the DATA_LENGTH. INDEX_LENGTH means "the size of all secondary indexes".