Last Updated:

How to find out the size of a table - MySQL

 
Execute a query to get the size of a table in a MySql database.

In order to get the size of the table in the database, you need to execute the query:

In this query, you only need to substitute the name of the database and the name of the table.
In my example, the database is called test, and the table name is test_db.

Query result:

My test_db table was 3.52 megabytes in size.

To get the size of all tables from all databases, run the following query:

This query returns a list of all tables from all databases and sorts them in descending order.

Example:
SELECT
     table_name AS `Table`,
     round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM information_schema.TABLES
WHERE table_schema = "Database name"
     AND table_name = "Table name";
Size of Table in mysql
SELECT 
     table_schema as `Database`, 
     table_name AS `Table`, 
     round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
ORDER BY (data_length + index_length) DESC;

Size of Table in mysql