From 801c2dc72cb3c68a7c430bb244675b7a68fd541a Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Thu, 13 Feb 2014 19:30:30 -0300 Subject: Separate multixact freezing parameters from xid's Previously we were piggybacking on transaction ID parameters to freeze multixacts; but since there isn't necessarily any relationship between rates of Xid and multixact consumption, this turns out not to be a good idea. Therefore, we now have multixact-specific freezing parameters: vacuum_multixact_freeze_min_age: when to remove multis as we come across them in vacuum (default to 5 million, i.e. early in comparison to Xid's default of 50 million) vacuum_multixact_freeze_table_age: when to force whole-table scans instead of scanning only the pages marked as not all visible in visibility map (default to 150 million, same as for Xids). Whichever of both which reaches the 150 million mark earlier will cause a whole-table scan. autovacuum_multixact_freeze_max_age: when for cause emergency, uninterruptible whole-table scans (default to 400 million, double as that for Xids). This means there shouldn't be more frequent emergency vacuuming than previously, unless multixacts are being used very rapidly. Backpatch to 9.3 where multixacts were made to persist enough to require freezing. To avoid an ABI break in 9.3, VacuumStmt has a couple of fields in an unnatural place, and StdRdOptions is split in two so that the newly added fields can go at the end. Patch by me, reviewed by Robert Haas, with additional input from Andres Freund and Tom Lane. --- src/include/commands/vacuum.h | 4 ++++ src/include/nodes/parsenodes.h | 4 ++++ src/include/postmaster/autovacuum.h | 1 + src/include/utils/rel.h | 3 +++ 4 files changed, 12 insertions(+) (limited to 'src/include') diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 7c368905393..70350e02cb2 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -136,6 +136,8 @@ extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for * PostGIS */ extern int vacuum_freeze_min_age; extern int vacuum_freeze_table_age; +extern int vacuum_multixact_freeze_min_age; +extern int vacuum_multixact_freeze_table_age; /* in commands/vacuum.c */ @@ -156,6 +158,8 @@ extern void vac_update_relstats(Relation relation, TransactionId frozenxid, MultiXactId minmulti); extern void vacuum_set_xid_limits(int freeze_min_age, int freeze_table_age, + int multixact_freeze_min_age, + int multixact_freeze_table_age, bool sharedRel, TransactionId *oldestXmin, TransactionId *freezeLimit, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index ad58b3949b6..f649ad4aa07 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -2533,6 +2533,10 @@ typedef struct VacuumStmt int options; /* OR of VacuumOption flags */ int freeze_min_age; /* min freeze age, or -1 to use default */ int freeze_table_age; /* age at which to scan whole table */ + int multixact_freeze_min_age; /* min multixact freeze age, + * or -1 to use default */ + int multixact_freeze_table_age; /* multixact age at which to + * scan whole table */ RangeVar *relation; /* single table to process, or NULL */ List *va_cols; /* list of column names, or NIL for all */ } VacuumStmt; diff --git a/src/include/postmaster/autovacuum.h b/src/include/postmaster/autovacuum.h index 543445cc2cb..a43fcb11d1c 100644 --- a/src/include/postmaster/autovacuum.h +++ b/src/include/postmaster/autovacuum.h @@ -25,6 +25,7 @@ extern double autovacuum_vac_scale; extern int autovacuum_anl_thresh; extern double autovacuum_anl_scale; extern int autovacuum_freeze_max_age; +extern int autovacuum_multixact_freeze_max_age; extern int autovacuum_vac_cost_delay; extern int autovacuum_vac_cost_limit; diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 9b8a4c9aa50..c87dadc0ebd 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -206,6 +206,9 @@ typedef struct AutoVacOpts int freeze_min_age; int freeze_max_age; int freeze_table_age; + int multixact_freeze_min_age; + int multixact_freeze_max_age; + int multixact_freeze_table_age; float8 vacuum_scale_factor; float8 analyze_scale_factor; } AutoVacOpts; -- cgit v1.2.3