关于资源:查看mysql数据库各个库资源使用情况

38次阅读

共计 249 个字符,预计需要花费 1 分钟才能阅读完成。

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)’
from information_schema.tables
group by table_schema
order by sum(data_length) desc, sum(index_length) desc;

正文完
 0