MySQL list tables by size

SELECT
    table_name AS `Table`,
    round(((data_length + index_length) / 1024 / 1024), 2) `size`
FROM information_schema.TABLES
WHERE table_schema = "$DB_NAME"
ORDER BY size DESC;

Links

  • [[2025-W41]]