Hi all , in this post i am going to show you how to check current mysql database size, below queries are tested on Mysql 5.5.8

Just fire below queries on your mysql db you will have your results ready on terminal.

For calculating db size 2 things should be considered

  • Data length
  • Index length

###Checking for full database size on server :-

 
SELECT table_schema "Database Name", SUM( data_length + index_length)
 / 1024 / 1024 /1024 "Size in GB" FROM information_schema.TABLES
 GROUP BY table_schema;

###Checking in details with each table size in single schema :-

SELECT TABLE_NAME, table_rows, data_length, index_length, 
round(((data_length + index_length) / 1024 / 1024 / 1024),2) "Size in GB"
FROM information_schema.TABLES WHERE table_schema = "your_schema_name";

For checking the database size in MB just remove one ‘/1024’ from quries.

Happy coding.. :)

Comments