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

Mar 12, 2012   //   by phpfreelancer.biz   //   Blog, MySQL Tutorial  //  No Comments

To get the sizes of all tables in a mysql database:

show table status from myDatabaseName;

I looking for the tables with bigger sizes.So which column should I look at?

You can use this query in order to know the size of a table:

SELECT table_name AS "Table", 
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" 
FROM information_schema.TABLES 
WHERE table_schema = "$DB_NAME"
AND table_name = "$TABLE_NAME";

Leave a comment

Share This Post

RSS Wordpress News