Find the database with the biggest size


Problem

Running out of disk space and want to find the database using the most space on your computer?



Solution

SELECT  
  table_schema as database_name,
  round(sum(data_length + index_length) / 1024 / 1024, 2) as database_size
FROM information_schema.tables 
GROUP BY table_schema 
ORDER BY 2 DESC

Comments




Please sign-in to post a comment