]> 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:37:53 +0000 (14:37 -0400)
committerAndrew Dunstan <andrew@dunslane.net>
Mon, 2 Sep 2013 18:37:53 +0000 (14:37 -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 ab5984f4bc5282b2db5661520dc8b64a9c06e433..616e41d52d2986cb2ab1699d2acb76bc5e40d9ef 100644 (file)
     examine this information is to execute queries such as:
 
 <programlisting>
-SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind IN ('r', 'm');
+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 IN ('r', 'm');
+
 SELECT datname, age(datfrozenxid) FROM pg_database;
 </programlisting>