文件名:schema_engines.sql
作用:按照库名,引擎类型分类统计 表的总大小,数据总大小,索引总大小,表的数量。
代码:
- SELECT table_schema, engine,
- ROUND(SUM(data_length+index_length)/1024/1024) AS total_mb,
- ROUND(SUM(data_length)/1024/1024) AS data_mb,
- ROUND(SUM(index_length)/1024/1024) AS index_mb,
- COUNT(*) AS tables
- FROM information_schema.tables
- GROUP BY table_schema, engine
- ORDER BY 3 DESC;
阅读(771) | 评论(0) | 转发(0) |