查询数据库的使用情况

SELECT 
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024/1024, 2)) as '数据容量(MB)',
sum(truncate(index_length/1024/1024, 2)) as '索引容量(MB)',
sum(truncate(DATA_FREE/1024/1024, 2)) as '碎片占用(MB)'
from information_schema.tables
where table_schema='database'
order by data_length desc, index_length desc;

database 替换成要查询的库 database 替换成要查询的库#

本作品采用《CC 协议》,转载必须注明作者和本文链接
有梦想的人睡不着,没有梦想的人睡不醒。
文章
88
粉丝
23
喜欢
134
收藏
270
排名:227
访问:4.2 万
私信
所有博文
博客标签
展开
社区赞助商