we can execute a query that will list all tables in a specific database along with the disk space (size) of each.
We can list all the tables along with each table size (disk space) by using a query.
SELECT table_name AS Table
, ROUND(((data_length + index_length) / 1024 / 1024), 2) Size (MB)
FROM information_schema.TABLES WHERE table_schema = “$Database_Name”;
Query to get list the size of every table in every database, with of the order of size:
SELECT
table_schema as DatabaseName
,
table_name AS TableName
,
round(((data_length + index_length) / 1024 / 1024), 2) Size in MB
FROM information_schema.TableName
ORDER BY (data_length + index_length) DESC;
Query to get size of all databases
SELECT table_schema “Data Base Name”, SUM( data_length + index_length) / 1024 / 1024
“Data Base Size in MB” FROM information_schema.TABLES GROUP BY table_schema ;