Skip to content

Instantly share code, notes, and snippets.

@RahulSDeshpande
Created July 19, 2021 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RahulSDeshpande/690e946b7937b6899091bade4e7d4452 to your computer and use it in GitHub Desktop.
Save RahulSDeshpande/690e946b7937b6899091bade4e7d4452 to your computer and use it in GitHub Desktop.
MySQL query to calculate sizes of all the DBs
SELECT table_schema AS "Database",
ROUND(SUM(data_length + index_length) / 1024 / 1024, 2) AS "Size (MB)"
FROM information_schema.TABLES
GROUP BY table_schema;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment