mysql查看索引的大小

 

 

1 ,show table status from your_database_name  这个不准;

2,这个比较详细
select
database_name,
table_name,
index_name,
round((stat_value*@@innodb_page_size)/1024/1024, 2) SizeMB,
round(((100/(SELECT INDEX_LENGTH FROM INFORMATION_SCHEMA.TABLES t WHERE t.TABLE_NAME = iis.table_name and t.TABLE_SCHEMA = iis.database_name))*(stat_value*@@innodb_page_size)), 2) `Percentage`
from mysql.innodb_index_stats iis
where stat_name='size'
and table_name = 'your_table'
and database_name = 'your_database_name'

posted @ 2019-09-24 17:23  zzhi.wang  阅读(2308)  评论(0编辑  收藏  举报