MYSQL 查询占用空间最大的前 10 张表

SELECT
table_schema AS ' 数据库 ',
table_name AS ' 表名 ',
a.TABLE_TYPE,
a.`ENGINE`,
a.CREATE_TIME,
a.UPDATE_TIME,
a.TABLE_COLLATION,
table_rows AS ' 记录数 ',
TRUNCATE (data_length / 1024 / 1024, 2) AS ' 数据容量 (MB)',
TRUNCATE (index_length / 1024 / 1024, 2) AS ' 索引容量 (MB)',
TRUNCATE (( data_length + index_length) / 1024 / 1024, 2 ) AS ' 总大小 (MB)'
FROM information_schema.TABLES a
ORDER BY ( data_length + index_length ) DESC
LIMIT 10;
posted @ 2025-05-11 09:04  abowu  阅读(53)  评论(0)    收藏  举报