赞
踩
一、统计每个数据库的大小
- 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_size desc;
二、统计某个数据库中的每张表的大小
- select table_name,table_rows,concat(truncate(data_length/1024/1024,2),'MB') from information_schema.tables
- where TABLE_SCHEMA = 'test'
- order by table_rows desc;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。