首页 > 数据库技术 > 详细

MYSQL查看表与库的容量大小

时间:2018-06-11 13:39:38      阅读:169      评论:0      收藏:0      [点我收藏+]

查看表的容量大小
mysql> use information_schema;
select data_length,index_length
from tables where
table_schema='test'
 and table_name = 'test_table';

#字节转MB
select concat(round(sum(data_length/1024/1024),2),'MB') as data_size_mb,
concat(round(sum(index_length/1024/1024),2),'MB') as  index_size_mb
from tables where
table_schema='test'
and table_name = 'test_table';


查看库的容量大小
select TABLE_SCHEMA, concat(truncate(sum(data_length)/1024/1024,2),' MB') as data_size,
concat(truncate(sum(index_length)/1024/1024,2),'MB') as index_size
from information_schema.tables
group by TABLE_SCHEMA
order by data_length desc;


MYSQL查看表与库的容量大小

原文:http://blog.51cto.com/stoneryan/2128001

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!