查询某个库下所有表&索引的数据量及占用空间大小
SELECTtable_schema AS '数据库',table_name AS '表名',table_rows AS '记录数',TRUNCATE ( data_length / 1024 / 1024, 2 ) AS '数据容量(MB)',TRUNCATE ( index_length / 1024 / 1024, 2 ) AS '索引容量(MB)' FROMinformation_schema.TABLES WHEREtable_schema = 'mysql' ORDER BYtable_rows DESC,index_length DESC;
参考
MySQL查看表占用空间大小_A狼行天下A的博客-CSDN博客_mysql查询表空间大小及使用情况