MySQLの各テーブルサイズの取得
よく忘れるのでメモしておく。
select
table_name,
table_comment,
table_rows,
avg_row_length,
round((data_length + index_length)/1024/1024) as total_size,
round(data_length/1024/1024) as data_size,
round(index_length/1024/1024) as index_size
from INFORMATION_SCHEMA.TABLES
where table_schema = 'DATABASE_NAME'
order by total_size desc, data_size desc, index_size desc, table_name;