データベースのサイズを確認
SELECT
table_schema AS "データベース名"
, FLOOR(SUM(data_length + index_length) / 1024 / 1024) AS "合計容量(MB)"
FROM information_schema.tables
GROUP BY
table_schema
ORDER BY
SUM(data_length + index_length) DESC
;
テーブルのサイズを確認
SELECT
table_name AS "テーブル名"
, FLOOR((data_length + index_length) / 1024 / 1024) AS "合計容量(MB)"
, FLOOR((data_length) / 1024 / 1024) AS "データ容量(MB)"
, FLOOR((index_length) / 1024 / 1024) AS "インデックス容量(MB)"
, table_rows AS "行数"
, avg_row_length AS "平均行容量"
, engine AS "ストレージエンジン"
FROM information_schema.tables
WHERE table_schema = database()
ORDER BY
(data_length + index_length) DESC
;
コメント