Reputation: 357
I am new to the MySQL learning. I have a database that consist of 34 tables. I just want to know the memory size of database and each tables. Is there any special query or script to finding the memory size? please help me out with this. am using InnoDB engine.
Upvotes: 0
Views: 260
Reputation:
For 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;
For table
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;
Upvotes: 1