首页 > 数据库技术 > 详细

mysql查询数据库大小和表

时间:2014-12-10 17:43:11      阅读:365      评论:0      收藏:0      [点我收藏+]

每个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查看数据库和表的占用空间大小

mysql查询数据库大小和表

原文:http://www.cnblogs.com/wardensky/p/4155840.html

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