查询库和表的大小
查询所有库的大小
select
table_schema,
sum(data_length+index_length)/1024/1024/1024 as total_gb,
sum(data_length)/1024/1024/1024 as data_gb,
sum(index_length)/1024/1024/1024 as index_gb,
count(*) as tables,
curdate() as today
from
information_schema.tables
group by table_schema
order by 2 desc;
查询库中所有表的大小
select
table_name,
sum(data_length + index_length) as total_size
from
information_schema.tables
group by table_name
order by total_size desc;