MySQLのテーブル利用状況が知りたい
概算をinformation_schemaから出す。
code:tables.sql
SELECT
table_schema AS db,
table_name AS tbl,
engine,
table_rows AS tbl_rows,
avg_row_length AS row_len,
FLOOR((data_length+index_length)/1024/1024) AS all_mb,
FLOOR((data_length)/1024/1024) AS data_mb,
FLOOR((index_length)/1024/1024) AS idx_mb
FROM
information_schema.tables
WHERE
table_schema NOT IN ('information_schema', 'performance_schema', 'mysql', 'sys')
ORDER BY
table_schema, table_name, tbl_rows DESC;