Skip to content

Instantly share code, notes, and snippets.

@commondatageek
Created May 7, 2017 01:26
Show Gist options
  • Save commondatageek/989f5c5a662312389f89d4f0766a93d3 to your computer and use it in GitHub Desktop.
Save commondatageek/989f5c5a662312389f89d4f0766a93d3 to your computer and use it in GitHub Desktop.
Fast count rows in postgresql
-- from Erwin Brandstetter
-- http://stackoverflow.com/a/7945274/852196
SELECT reltuples::bigint AS estimate
FROM pg_class
WHERE oid = 'myschema.mytable'::regclass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment