Skip to content

Instantly share code, notes, and snippets.

@forestbaker
Created August 29, 2016 20:45
Show Gist options
  • Save forestbaker/55cd30891bfcdc9278317fa3d50a283e to your computer and use it in GitHub Desktop.
Save forestbaker/55cd30891bfcdc9278317fa3d50a283e to your computer and use it in GitHub Desktop.
Useful MySQL Queries
# Display Storage Space used by Tables in a MySQL Database called "DiagDomain":
SELECT table_name AS "Tables", round(((data_length + index_length)/1024/1024/1024), 2) "Size in GB" FROM information_schema.TABLES WHERE table_schema = "DiagDomain" ORDER BY (data_length + index_length) DESC;
# Display Storage Space used by all MySQL Databases:
SELECT table_schema "database", sum(data_length + index_length)/1024/1024/1024 "Size in GB" 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