Created
March 23, 2017 11:34
-
-
Save thapakazi/8077cb171d8c618e608f7453b34bb5f9 to your computer and use it in GitHub Desktop.
Row counts for all tables in a postgres db.
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 schemaname,relname,n_live_tup | |
FROM pg_stat_user_tables | |
ORDER BY n_live_tup DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Exact Row Counts in Postgres
everything's copy&paste from this awesome blog Exact Row Counts for All Tables in MySQL and Postgres,
If tldr;
Make a function first
loop it through the
information_schema.tables
similar threads: if above failed 🤣