MySQL tables space

Well my database is starting to get bigger and bigger. So I use this small query to know which table is consuming the more space.

[cc_mysql escaped=”true”]
concat(table_schema, ‘.’, TABLE_NAME) AS “Tables”,
table_rows AS “# of Rows”,
round(((data_length + index_length) / 1024 / 1024), 2) “Size in MB”
FROM information_schema.TABLES
ORDER BY (data_length + index_length) DESC;

Leave a Reply