Skip to content

Instantly share code, notes, and snippets.

@Wintus
Created April 7, 2017 01:47
Show Gist options
  • Save Wintus/df6bb24509439f077e5ee55e81c942ab to your computer and use it in GitHub Desktop.
Save Wintus/df6bb24509439f077e5ee55e81c942ab to your computer and use it in GitHub Desktop.
PostgreSQL Table Size Query
SELECT relname, reltuples, (relpages / 128) as mbytes, (relpages * 8192.0 / (reltuples + 1e-10)) as average_row_size FROM pg_class ORDER BY mbytes DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment