A query to find the size of a table's data and indexes:

SELECT table_name, engine, row_format, table_rows, avg_row_length,
 (data_length + index_length) / 1024 / 1024 AS total_mb,
 (data_length) / 1024 / 1024 AS data_mb,
 (index_length) / 1024 / 1024 AS index_mb
 FROM information_schema.tables
 WHERE table_schema = 'foo'
 AND table_name LIKE 'bar';

This can also be a quick way to find the number of rows in a big innodb table.

Also, check these out.


CategoryDatabase

MySQLTableSize (last edited 2008-07-31 15:29:12 by DavidKeen)