Skip links

How can I get database table sizes?

If you want to get database tables sizes using MySQL you can do it as follows.
MySQL system database called information_schema. It has right information for those who want to get DB table real size.
First of all you must go to the MySQL “information_schema” and get “schema name” of the database from the “SCHEMATA” table.
Following MYSQL Query run in your database.

table_rows AS "Quant of Rows", ROUND( (
data_length + index_length
) /1024, 2 ) AS "Total Size Kb"
FROM information_schema.TABLES
WHERE information_schema.TABLES.table_schema = 'your_database_schema_name_here'
LIMIT 0 , 30

Then you can view the table sizes like this.

How can we get size of the mysql databases?

Just copy and paste,run this query in the phpmyadmin.

SELECT table_schema "DB Name",
Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM   information_schema.tables
GROUP  BY table_schema;

Result as following.