作用:统计每个库的真实数据与索引数据的总和的大小单位为MB,真实数据的大小单位MB,索引数据的大小MB,含有表的总数,当前日期。并且以每个库的大小倒序排序。
SELECT table_schema,\
SUM(data_length+index_length)/1024/1024 AS total_mb,\
SUM(data_length)/1024/1024 AS data_mb,\
SUM(index_length)/1024/1024 AS index_mb,\
COUNT(*) AS tables,\
CURDATE() AS today \
FROM information_schema.tables \
GROUP BY table_schema \
ORDER BY 2 DESC;
阅读(1263) | 评论(0) | 转发(0) |