From 4e1e5d3bad9d51e5695c8a42612343662e886a64 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Mon, 2 Sep 2013 14:37:53 -0400 Subject: [PATCH] Fix relfrozenxid query in docs to include TOAST tables. 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 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/src/sgml/maintenance.sgml b/doc/src/sgml/maintenance.sgml index ab5984f4bc..616e41d52d 100644 --- a/doc/src/sgml/maintenance.sgml +++ b/doc/src/sgml/maintenance.sgml @@ -534,7 +534,12 @@ examine this information is to execute queries such as: -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; -- 2.40.0