Get the storage size of data and index of all tables in a MySQL database

    table_name AS `Table`, 
    data_length, index_length
FROM information_schema.TABLES 
WHERE table_schema = "db_name"
ORDER BY data_length DESC;
SELECT database_name, table_name, index_name,
ROUND(stat_value * @@innodb_page_size / 1024 / 1024, 2) size_in_mb
FROM mysql.innodb_index_stats
WHERE stat_name = 'size' AND database_name = "db_name"
ORDER BY size_in_mb DESC;
Scroll to Top