Skip to content

Instantly share code, notes, and snippets.

@aks
Created April 21, 2020 15:59
Show Gist options
  • Save aks/d25018332da3ebf7b8336d0fa962e830 to your computer and use it in GitHub Desktop.
Save aks/d25018332da3ebf7b8336d0fa962e830 to your computer and use it in GitHub Desktop.
Fast query for table size
-- query a large table for its size without doing a full-table scan
-- replace the table name as needed
SELECT to_char(reltuples::bigint,'999,999,999,999') AS estimate
FROM pg_class
WHERE relname='BIG_TABLE';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment