How to get the sizes of the tables of a MySQL database - MySQL Developer Tutorial

How to get the sizes of the tables of a MySQL database

Below query can be used to get the size of tables in a database in MySQL. We will use information_schema.table system table to get the name for tables and size.

SELECT 
    table_name AS `Table`, 
    round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB` 
FROM information_schema.TABLES 
WHERE table_schema = "YourDatabaseName";


Update the above query according to your database name and you will get the list of tables in specific databases with size in MB.


Determine size of tables in MySQL database - MySQL Tutorial for developers

1 comment: