查询单个库中所有表磁盘占用大小的SQL语句:

select TABLE_NAME, concat(truncate(data_length/1024/1024,2),' MB') as data_size,
concat(truncate(index_length/1024/1024,2),' MB') as index_size
from information_schema.tables where TABLE_SCHEMA = 'TestDB'
group by TABLE_NAME

order by data_length desc;



以上语句测试有效,注意替换以上的TestDB为数据库名


以上语句测试有效,注意替换以上的TestDB为数据库名

猜你喜欢

转载自blog.csdn.net/qq_36617310/article/details/79306576
今日推荐