如何查看mysql数据库各个表的大小
参考原文: https://www.cnblogs.com/chuanzhang053/p/16937461.html
查看每个库中表的大小,按大小排序
注意:表占用空间大小,包括 数据 和 索引
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;
查看某个特定的库中,表的大小
SELECT
table_schema as `Database`,
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "iuap_data_datafusion" # 替换为具体的库名
ORDER BY (data_length + index_length) DESC;