Skip to content

Instantly share code, notes, and snippets.

@BenConstable
Last active December 16, 2015 12:18
Show Gist options
  • Save BenConstable/5433228 to your computer and use it in GitHub Desktop.
Save BenConstable/5433228 to your computer and use it in GitHub Desktop.
Little MySQL query to find the size of database.
# Adapted from http://stackoverflow.com/questions/1733507/how-to-get-size-of-mysql-database
SELECT Round(Sum(data_length + index_length) / 1024 / 1024, 1) "DB Size in MB"
FROM information_schema.tables
WHERE table_schema = "database_name" # Replace this with the name of the database you want to inspect
GROUP BY table_schema;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment