Skip to content

Instantly share code, notes, and snippets.

@manuelvanrijn
Created July 30, 2012 08:12
Show Gist options
  • Save manuelvanrijn/3205631 to your computer and use it in GitHub Desktop.
Save manuelvanrijn/3205631 to your computer and use it in GitHub Desktop.
SELECT total_rows FROM postgres_database
SELECT
SUM(pgClass.reltuples) AS totalRowCount
FROM
pg_class pgClass
LEFT JOIN
pg_namespace pgNamespace ON (pgNamespace.oid = pgClass.relnamespace)
WHERE
pgNamespace.nspname NOT IN ('pg_catalog', 'information_schema') AND
pgClass.relkind='r'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment