# 1.查看所有数据库容量大小
select
table_schema as '数据库',
sum(table_rows) as '记录数',
sum(truncate(data_length/1024...select
table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length/1024/1024...information_schema.tables
order by data_length desc, index_length desc;
# 3.查看demo库容量大小
select
table_schema as '数据库'...1024/1024, 2)) as '索引容量(MB)'
from information_schema.tables
where table_schema='demo';
# 4.查看zabbix库中各表大小...select
table_schema as '数据库',
table_name as '表名',
table_rows as '记录数',
truncate(data_length/1024/1024