Showing database size

My co-worker asked me how big is the mysql DB, I don't really know how so I did a little research and found this...


SELECT table_schema "Database", sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB"
FROM information_schema.TABLES GROUP BY table_schema ;


And it works =D
It basically just go to the information_schema and sum up the size of the tables of each schema.

The output looks something like this

+--------------------+----------------------+
| Database | Data Base Size in MB |
+--------------------+----------------------+
| dms | 4.51943684 |
| hrform | 0.06588364 |
| information_schema | 0.00390625 |
| mysql | 0.42193222 |
| ptrng | 0.05598068 |
| securewiki | 1.52050400 |
| wiki | 584.47095490 |
+--------------------+----------------------+

Comments (0)

Post a Comment