MySQL - Get size of table

Get the Size of all tables in a database

select table_name, round(((data_length + index_length) / (1024*1024)),2) as 'size in megs' from information_schema.tables where table_schema = 'the_name_of_my_db';

Get the Size of a specific table in a database

select table_name, round(((data_length + index_length) / (1024*1024)),2) as 'size in megs' from information_schema.tables where table_schema = 'the_name_of_my_db' AND table_name = 'the_name_of_my_table';


The name "table_schema" is a bit misleading, in fact  you have to specify the database name.


REFERENCES: https://mikewilliamson.wordpress.com/2009/11/27/mysql-tables-calculating-size-on-disk/