How to know the actual size of your MySQL database tables

By Web Design

The file size of a MySQL database dump is not necessarily the size of that information when it’s deployed in the database. In addition to that, when you are debugging data issues, it’s crucial to review the size of your database tables.

With this SQL query you will get a report of the tables in your database, with their corresponding size:

SELECT table_name AS "Tables", round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" 
FROM information_schema.TABLES 
WHERE table_schema = "project" 
ORDER BY (data_length + index_length) DESC;

Just ensure to replace the table_schema name with the one you’re using in your project.

Tagged under: