File tree Expand file tree Collapse file tree 5 files changed +26
-2
lines changed Expand file tree Collapse file tree 5 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -640,7 +640,12 @@ HINT: Stop the postmaster and vacuum that database in single-user mode.
640640 possible multixact ID still appearing in any tuple of that table.
641641 If this value is older than
642642 <xref linkend="guc-vacuum-multixact-freeze-table-age">, a whole-table
643- scan is forced. Whole-table <command>VACUUM</> scans, regardless of
643+ scan is forced. <function>mxid_age()</> can be used on
644+ <structname>pg_class</>.<structfield>relminmxid</> to find its age.
645+ </para>
646+
647+ <para>
648+ Whole-table <command>VACUUM</> scans, regardless of
644649 what causes them, enable advancing the value for that table.
645650 Eventually, as all tables in all databases are scanned and their
646651 oldest multixact values are advanced, on-disk storage for older
Original file line number Diff line number Diff line change 1616
1717#include <limits.h>
1818
19+ #include "access/multixact.h"
1920#include "access/transam.h"
2021#include "access/xact.h"
2122#include "libpq/pqformat.h"
@@ -102,6 +103,21 @@ xid_age(PG_FUNCTION_ARGS)
102103 PG_RETURN_INT32 ((int32 ) (now - xid ));
103104}
104105
106+ /*
107+ * mxid_age - compute age of a multi XID (relative to latest stable mxid)
108+ */
109+ Datum
110+ mxid_age (PG_FUNCTION_ARGS )
111+ {
112+ TransactionId xid = PG_GETARG_TRANSACTIONID (0 );
113+ MultiXactId now = ReadNextMultiXactId ();
114+
115+ if (!MultiXactIdIsValid (xid ))
116+ PG_RETURN_INT32 (INT_MAX );
117+
118+ PG_RETURN_INT32 ((int32 ) (now - xid ));
119+ }
120+
105121/*
106122 * xidComparator
107123 * qsort comparison function for XIDs
Original file line number Diff line number Diff line change 5353 */
5454
5555/* yyyymmddN */
56- #define CATALOG_VERSION_NO 201409091
56+ #define CATALOG_VERSION_NO 201409101
5757
5858#endif
Original file line number Diff line number Diff line change @@ -1279,6 +1279,8 @@ DATA(insert OID = 1180 ( abstime PGNSP PGUID 12 1 0 0 0 f f f f t f i 1 0 7
12791279DESCR ("convert timestamp with time zone to abstime" );
12801280DATA (insert OID = 1181 ( age PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ xid_age _null_ _null_ _null_ ));
12811281DESCR ("age of a transaction ID, in transactions before current transaction" );
1282+ DATA (insert OID = 3939 ( mxid_age PGNSP PGUID 12 1 0 0 0 f f f f t f s 1 0 23 "28" _null_ _null_ _null_ _null_ mxid_age _null_ _null_ _null_ ));
1283+ DESCR ("age of a multi-transaction ID, in multi-transactions before current multi-transaction" );
12821284
12831285DATA (insert OID = 1188 ( timestamptz_mi PGNSP PGUID 12 1 0 0 0 f f f f t f i 2 0 1186 "1184 1184" _null_ _null_ _null_ _null_ timestamp_mi _null_ _null_ _null_ ));
12841286DATA (insert OID = 1189 ( timestamptz_pl_interval PGNSP PGUID 12 1 0 0 0 f f f f t f s 2 0 1184 "1184 1186" _null_ _null_ _null_ _null_ timestamptz_pl_interval _null_ _null_ _null_ ));
Original file line number Diff line number Diff line change @@ -845,6 +845,7 @@ extern Datum xidrecv(PG_FUNCTION_ARGS);
845845extern Datum xidsend (PG_FUNCTION_ARGS );
846846extern Datum xideq (PG_FUNCTION_ARGS );
847847extern Datum xid_age (PG_FUNCTION_ARGS );
848+ extern Datum mxid_age (PG_FUNCTION_ARGS );
848849extern int xidComparator (const void * arg1 , const void * arg2 );
849850extern Datum cidin (PG_FUNCTION_ARGS );
850851extern Datum cidout (PG_FUNCTION_ARGS );
You can’t perform that action at this time.
0 commit comments