Skip to content

Instantly share code, notes, and snippets.

@vyach-vasiliev
Forked from AndreyStekov/pg_schema_size.sql
Created August 4, 2023 16:29
Show Gist options
  • Save vyach-vasiliev/1e1a37065e596d917f3d4953d8f2932a to your computer and use it in GitHub Desktop.
Save vyach-vasiliev/1e1a37065e596d917f3d4953d8f2932a to your computer and use it in GitHub Desktop.
Get schema size (postgres).
SELECT pg_size_pretty(sum(pg_relation_size(quote_ident(schemaname) || '.' || quote_ident(tablename)))::bigint) FROM pg_tables
WHERE schemaname = 'yourschema'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment