in this post, I can get the row count from nominated table.
Fast way to discover the row count of a table in PostgreSQL
SELECT count(*) AS exact_count FROM myschema.mytable;
But how can I list the row count and table size for top 10 biggest tables?
idea is:
But how can I do it in one sql command?
Just check the statistics about the tables, much easier and faster:
SELECT schemaname
, relname
, n_live_tup
, pg_size_pretty(pg_relation_size(relid)) AS table_size
, pg_size_pretty(pg_indexes_size(relid)) AS index_size
FROM pg_stat_user_tables
ORDER BY pg_relation_size(relid) DESC, n_live_tup DESC
LIMIT 10;