Friday, 11 December 2015

Query to calculate MySQL DataBase Size

Sum up the data_length + index_length is equal to the total table size.

  1. data_length – store the real data.
  2. index_length – store the table index.
Here’s the SQL script to list out the entire databases size

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

No comments:

Post a Comment