Skip to content

Instantly share code, notes, and snippets.

@arsham
Forked from cmlenz/gist:1992369
Last active August 29, 2015 14:14
Show Gist options
  • Save arsham/1a8650d883abb3ae775c to your computer and use it in GitHub Desktop.
Save arsham/1a8650d883abb3ae775c to your computer and use it in GitHub Desktop.
-- PostgreSql
SELECT
pg_database.datname AS "Database Name",
pg_database_size(pg_database.datname) / 1024.0 / 1024.0 AS "Database Size (MB)"
FROM pg_database;
-- MySql
SELECT
table_schema "Database Name",
sum( data_length + index_length ) / 1024 / 1024 "Database 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