mysql查询数据库大小和表

时间:2014-12-10 17:46:05   收藏:0   阅读:222

每个mysql都有一个库information_schema,里面有一张表TABLES存储了所有数据库表的信息,因此,可以从这张表中查看数据库大小和表大小

 

查询数据库大小

select concat(round((sum(data_length)+sum(index_length))/1024/1024/1024,2),GB) as data  from information_schema.tables where table_schema=esb;

 

查询数据库中表大小

select concat(round((sum(data_length)+sum(index_length))/1024/1024/1024,2),GB) as data  from information_schema.tables where table_schema=esb and table_name=perf_service;

 

 

参考:

怎样用命令查看Mysql数据库大小?

mysql查看数据库和表的占用空间大小

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!