MySQL——查看数据库大小
前言
为了计算一些后面的扩展,所以看下当前业务数据的存储
步骤
所有的信息都存放在information_schema
这个库里面,我们可以通过查询这个库中的数据来找到我们需要的数据。
查看所有库的数据和索引大小
select table_schema, concat(truncate(sum(data_length)/1024/1024/1024,2),\' GB\') as data_size,
concat(truncate(sum(index_length)/1024/1024/1024,2),\'GB\') as index_size
from information_schema.tables
group by table_schema
order by data_length desc;
版权声明:本文为wangyang0210原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。