Skip to content

Instantly share code, notes, and snippets.

@pv8
Created February 25, 2016 13:40
Show Gist options
  • Save pv8/71364d5a16a4d33d312a to your computer and use it in GitHub Desktop.
Save pv8/71364d5a16a4d33d312a to your computer and use it in GitHub Desktop.
Estimate row count on big tables fast (PostgreSQL)
SELECT reltuples::bigint AS count_estimate
FROM pg_class
WHERE oid = 'schema.table'::regclass;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment