Skip to content

Instantly share code, notes, and snippets.

@duuz
Created September 3, 2018 18:55
Show Gist options
  • Save duuz/69d1acd3f2d6a4e97bc294c0cb02c9a2 to your computer and use it in GitHub Desktop.
Save duuz/69d1acd3f2d6a4e97bc294c0cb02c9a2 to your computer and use it in GitHub Desktop.
Tamanho das tabelas(Disco) no PostgreSQL
SELECT esquema, tabela,
pg_size_pretty(pg_relation_size(esq_tab)) AS tamanho,
pg_size_pretty(pg_total_relation_size(esq_tab)) AS tamanho_total
FROM (SELECT tablename AS tabela,
schemaname AS esquema,
schemaname||'.'||tablename AS esq_tab
FROM pg_catalog.pg_tables
WHERE schemaname NOT
IN ('pg_catalog', 'information_schema', 'pg_toast') ) AS x
ORDER BY pg_total_relation_size(esq_tab) DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment