Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f002dc3

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 6a007fa commit f002dc3

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
@@ -534,7 +534,12 @@
534534
examine this information is to execute queries such as:
535535

536536
<programlisting>
537-
SELECT relname, age(relfrozenxid) FROM pg_class WHERE relkind IN ('r', 'm');
537+
SELECT c.oid::regclass as table_name,
538+
greatest(age(c.relfrozenxid),age(t.relfrozenxid)) as age
539+
FROM pg_class c
540+
LEFT JOIN pg_class t ON c.reltoastrelid = t.oid
541+
WHERE c.relkind IN ('r', 'm');
542+
538543
SELECT datname, age(datfrozenxid) FROM pg_database;
539544
</programlisting>
540545

0 commit comments

Comments
 (0)