8000 Fix relfrozenxid query in docs to include TOAST tables. · sqlparser/postgres@d1f638b · GitHub
[go: up one dir, main page]

Skip to content

Commit d1f638b

Browse files
committed
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.
1 parent fb5941d commit d1f638b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doc/src/sgml/maintenance.sgml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,12 @@
492492
examine this information is to execute queries such as:
493493

494494
<programlisting>
495-
SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind = 'r';
495+
SELECT c.oid::regclass as table_name,
496+
greatest(age(c.relfrozenxid),age(t.relfrozenxid)) as age
497+
FROM pg_class c
498+
LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
499+
WHERE c.relkind = 'r';
500+
496501
SELECT datname, age(datfrozenxid) FROM pg_database;
497502
</programlisting>
498503

0 commit comments

Comments
 (0)
0