1、查询语句
select
table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length/1024/1024, 2) as '数据容量(MB)',
truncate(index_length/1024/1024, 2) as '索引容量(MB)'
from information_schema.tables
where table_schema='prod_wh_whcloud_dc_radar' (指定的库名)
order by data_length desc, index_length desc;
介绍:
mysql的information_schema库中,tables存储了数据表的元数据信息,下面是其中几个字段的含义:
table_schema: 记录数据库名
table_name: 记录数据表名
table_rows: 关于表的粗略行估计
data_length : 记录表的大小(单位字节)
index_length : 记录表的索引的大小
2.查看