-- your_database_name 替换为你的数据库名
SELECT
table_schema AS `数据库`,
table_name AS `表名`,
CONCAT(ROUND(table_rows / 1000000, 2), 'M') AS `行数`,
CONCAT(ROUND(data_length / (1024 * 1024 ), 2), 'MB') AS `数据大小`,
CONCAT(ROUND(index_length / (1024 * 1024 ), 2), 'MB') AS `索引大小`,
CONCAT(ROUND((data_length + index_length) / (1024 * 1024 * 1024), 2), 'GB') AS `总大小`
FROM
information_schema.TABLES
WHERE
table_schema NOT IN ('information_schema', 'performance_schema', 'mysql', 'sys')
AND table_schema = 'your_database_name'
ORDER BY
data_length DESC;