DB(データベース)サイズの確認

Mysqlでデータベースのサイズの確認方法を紹介します。

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

GB単位、Mb単位の両方で取得

 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;

 

実行結果

MariaDB [(none)]> 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.000167846680 | 0.17187500 |
| mysql              | 0.000731797889 | 0.74936104 |
| sasuke             | 0.008529663086 | 8.73437500 |
| test               | 0.001312255859 | 1.34375000 |
+--------------------+----------------+------------+
5 rows in set (0.01 sec)

コメントを残す

CAPTCHA