我是MySQL学习的新手。我有一个由34个表组成的数据库。我只想知道数据库和每个表的内存大小。是否有任何特殊查询或脚本来查找内存大小?这个你能帮我吗。我正在使用InnoDB引擎。
答案 0 :(得分:1)
对于DB
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
表格
SELECT table_name AS "Table",
ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Size (MB)"
FROM information_schema.TABLES
WHERE table_schema = "database_name"
ORDER BY (data_length + index_length) DESC;