Skip to main content

How to check the sizes of tables in a MySQL database

Posted on May 5, 2022


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;

Change the database_name with the name of the database that you want to inspect.