Created
August 25, 2016 09:56
-
-
Save nburkley/2a2cb3d5b773095bf998f8f2c138171e to your computer and use it in GitHub Desktop.
Get all tables with their number of rows in PostgreSQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
pgClass.relname AS tableName, | |
pgClass.reltuples AS rowCount | |
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