How to check the size of all tables in MySQL?

You can use the following SQL statement to view the size of all tables in MySQL:

SELECT
    table_name AS `Table`,
    round(((data_length + index_length) / 1024 / 1024), 2) `Size (MB)`
FROM
    information_schema.TABLES
WHERE
    table_schema = 'your_database_name'
ORDER BY
    (data_length + index_length) DESC;

Replace your_database_name with the name of the database you want to query and execute the above SQL statement to view the size of all tables in that database, measured in MB.

bannerAds