All tables row count.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Mon, 13 Sep 2021 13:35:35 +0300
changeset 2511 ead0982db652
parent 2510 cdc491306fef
child 2512 b04ec90c2f8a
All tables row count.
postgres.rst
--- a/postgres.rst	Tue Jun 08 17:06:25 2021 +0300
+++ b/postgres.rst	Mon Sep 13 13:35:35 2021 +0300
@@ -441,6 +441,12 @@
 
   \d+
 
+All tables row count::
+
+  SELECT relname, n_live_tup FROM pg_stat_user_tables
+  WHERE schemaname = 'public'
+  ORDER BY n_live_tup DESC;
+
 Table total size (with indexes)::
 
   SELECT pg_size_pretty(pg_total_relation_size('schemaname.tablename'));