查看mysql指定库所有表大小容量

SELECT
table_name AS '表名',
ROUND((data_length + index_length) / 1024 / 1024, 2) AS '总大小(MB)',
ROUND(data_length / 1024 / 1024, 2) AS '数据大小(MB)',
ROUND(index_length / 1024 / 1024, 2) AS '索引大小(MB)',
table_rows AS '行数'
FROM information_schema.tables
WHERE table_schema = 'your_database_name'
ORDER BY (data_length + index_length) DESC;

posted @ 2026-09-23 09:29  zhaoguanhao  阅读(4)  评论(0)    收藏  举报