MySQL Size Queries

Here is some useful queries for finding MySQL database , schema or table size information.

  • Size of Database group by schema Name :

select table_schema "Schema Name",
sum(data_length + index_length)/1024/1024 "Data Base Size in MB"
from information_schema.tables group by table_schema;

  • Size of Schema group by table names :

select table_name, table_rows, data_length, index_length,
round(((data_length + index_length) / 1024 / 1024),2) "Size in MB"
from information_schema.tables where table_schema ='<Schema Name>';

  • All Database Size :

select sum( data_length + index_length) / 1024 / 1024 "Data Base Size in MB"
from information_schema.tables;