查询字段注释
表大小
第二种:查询所有数据的大小 select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from information_schema.TABLES 第三种:查看指定数据库的大小,比如说:数据库apoyl select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from information_schema.TABLES where table_schema=‘apoyl‘; 第四种:查看指定数据库的表的大小,比如说:数据库apoyl 中apoyl_test表 select concat(round(sum(DATA_LENGTH/1024/1024),2),‘MB‘) as data from information_schema.TABLES where table_schema=‘apoyl‘ and table_name=‘apoyl_test‘;
表容量
库的每个scheme 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 库的所有 select sum(记录数) ,sum(`数据容量(MB)`) ,sum(`索引容量(MB)`) from ( 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 )b;
原文:https://www.cnblogs.com/star521/p/13640831.html