MySQL - How to get the size of the tables?
How to get the size of the tables in MySQL?
1. Size of a specific table:
SELECT
table_name AS `Table`,
round(((data_length + index_length) / 1024 / 1024), 2) `Size in MB`
FROM
information_schema.TABLES
WHERE
table_schema = 'db_name'
AND table_name = 'table_name';
2. Size of all tables, descending order:
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;
Need a good GUI Tool for MySQL? TablePlus is a modern, native tool with an elegant UI that allows you to simultaneously manage multiple databases such as MySQL, PostgreSQL, SQLite, Microsoft SQL Server and more.
Not on Mac? Download TablePlus for Windows.
On Linux? Download TablePlus for Linux
Need a quick edit on the go? Download TablePlus for iOS.