Skip to content

Instantly share code, notes, and snippets.

@elecnix
Created July 6, 2010 21:50
Show Gist options
  • Select an option

  • Save elecnix/465974 to your computer and use it in GitHub Desktop.

Select an option

Save elecnix/465974 to your computer and use it in GitHub Desktop.
Show largest PostgreSQL tables
SELECT
pg_relation_size(c.oid),
pg_size_pretty(pg_relation_size(c.oid)),
relkind,
relname,
nspname
FROM
pg_class c,
pg_namespace n
WHERE
n.oid = c.relnamespace
ORDER BY pg_relation_size(c.oid) DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment