Which tables are the biggest?
Find what takes the disk space before you decide what to clean or archive.
SQL · Which tables are the biggest?Advanced
SELECT table_name,
table_rows,
ROUND(data_length / 1024 / 1024, 2) AS data_mb,
ROUND(index_length / 1024 / 1024, 2) AS index_mb,
ROUND((data_length + index_length) / 1024 / 1024, 2) AS total_mb
FROM information_schema.tables
WHERE table_schema = DATABASE()
ORDER BY (data_length + index_length) DESC
LIMIT 10;information_schemasizediagnostics