delicious

How to get the sizes of the tables of a MySQL database?

A murb'ed feed, posted more than 5 years ago filed in mysql, tricks, performance, database & table.

I was wondering how a MySQL DB export got so big. This handy snippet helped me find out.

SELECT 
   ->      table_schema as `Database`, 
   ->      table_name AS `Table`, 
   ->      round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
   -> FROM information_schema.TABLES 
   -> ORDER BY (data_length + index_length) DESC;

Go to the original link.