]> granicus.if.org Git - postgresql/commitdiff
Fix relfrozenxid query in docs to include TOAST tables.
authorAndrew Dunstan <andrew@dunslane.net>
Mon, 2 Sep 2013 18:35:26 +0000 (14:35 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 2 Sep 2013 18:35:26 +0000 (14:35 -0400)
The original query ignored TOAST tables which could result in tables
needing a vacuum not being reported.

Backpatch to all live branches.

doc/src/sgml/maintenance.sgml

index d7ca37c5f36c4e8ccbfce8d529a01220a9dbf62d..580f6173c7b53f342e6727b96fa1817e9c2d298f 100644 (file)
     examine this information is to execute queries such as:
 
 <programlisting>
-SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind = 'r';
+SELECT c.oid::regclass as table_name,
+       greatest(age(c.relfrozenxid),age(t.relfrozenxid)) as age
+FROM pg_class c
+LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
+WHERE c.relkind = 'r';
+
 SELECT datname, age(datfrozenxid) FROM pg_database;
 </programlisting>