Posted at

【SQL】データベースのサイズを確認

MysqlでGB単位、Mb単位の両方を表示するSQL文

select table_schema as db_name, sum(data_length+index_length) /1024 /1024/1024 as GB,sum(data_length+index_length) /1024 /1024 as MB from information_schema.tables group by table_schema;


実行結果例

db_name
GB
MB

information_schema
0.000009536743
0.00976563

mysql
0.000991821289
1.01562500