aboutsummaryrefslogtreecommitdiff
path: root/src/include/commands
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2015-03-18 11:52:33 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2015-03-18 11:52:33 -0300
commit0d831389749a3baaced7b984205b9894a82444b9 (patch)
treeca6bd7f632c9300cadbe66dc60f32a60231828fc /src/include/commands
parent4559167c6b75be334fabad70d7cc03a38a08d494 (diff)
downloadpostgresql-0d831389749a3baaced7b984205b9894a82444b9.tar.gz
postgresql-0d831389749a3baaced7b984205b9894a82444b9.zip
Rationalize vacuuming options and parameters
We were involving the parser too much in setting up initial vacuuming parameters. This patch moves that responsibility elsewhere to simplify code, and also to make future additions easier. To do this, create a new struct VacuumParams which is filled just prior to vacuum execution, instead of at parse time; for user-invoked vacuuming this is set up in a new function ExecVacuum, while autovacuum sets it up by itself. While at it, add a new member VACOPT_SKIPTOAST to enum VacuumOption, only set by autovacuum, which is used to disable vacuuming of the toast table instead of the old do_toast parameter; this relieves the argument list of vacuum() and some callees a bit. This partially makes up for having added more arguments in an effort to avoid having autovacuum from constructing a VacuumStmt parse node. Author: Michael Paquier. Some tweaks by Álvaro Reviewed by: Robert Haas, Stephen Frost, Álvaro Herrera
Diffstat (limited to 'src/include/commands')
-rw-r--r--src/include/commands/vacuum.h28
1 files changed, 22 insertions, 6 deletions
diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h
index 4275484349d..9fd25169230 100644
--- a/src/include/commands/vacuum.h
+++ b/src/include/commands/vacuum.h
@@ -130,6 +130,19 @@ typedef struct VacAttrStats
int rowstride;
} VacAttrStats;
+/*
+ * Parameters customizing behavior of VACUUM and ANALYZE.
+ */
+typedef struct VacuumParams
+{
+ int freeze_min_age; /* min freeze age, -1 to use default */
+ int freeze_table_age; /* age at which to scan whole table */
+ int multixact_freeze_min_age; /* min multixact freeze age,
+ * -1 to use default */
+ int multixact_freeze_table_age; /* multixact age at which to
+ * scan whole table */
+ bool is_wraparound; /* force a for-wraparound vacuum */
+} VacuumParams;
/* GUC parameters */
extern PGDLLIMPORT int default_statistics_target; /* PGDLLIMPORT for
@@ -141,8 +154,10 @@ extern int vacuum_multixact_freeze_table_age;
/* in commands/vacuum.c */
-extern void vacuum(VacuumStmt *vacstmt, Oid relid, bool do_toast,
- BufferAccessStrategy bstrategy, bool for_wraparound, bool isTopLevel);
+extern void ExecVacuum(VacuumStmt *vacstmt, bool isTopLevel);
+extern void vacuum(int options, RangeVar *relation, Oid relid,
+ VacuumParams *params, List *va_cols,
+ BufferAccessStrategy bstrategy, bool isTopLevel);
extern void vac_open_indexes(Relation relation, LOCKMODE lockmode,
int *nindexes, Relation **Irel);
extern void vac_close_indexes(int nindexes, Relation *Irel, LOCKMODE lockmode);
@@ -171,12 +186,13 @@ extern void vac_update_datfrozenxid(void);
extern void vacuum_delay_point(void);
/* in commands/vacuumlazy.c */
-extern void lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
- BufferAccessStrategy bstrategy);
+extern void lazy_vacuum_rel(Relation onerel, int options,
+ VacuumParams *params, BufferAccessStrategy bstrategy);
/* in commands/analyze.c */
-extern void analyze_rel(Oid relid, VacuumStmt *vacstmt,
- bool in_outer_xact, BufferAccessStrategy bstrategy);
+extern void analyze_rel(Oid relid, RangeVar *relation, int options,
+ List *va_cols, bool in_outer_xact,
+ BufferAccessStrategy bstrategy);
extern bool std_typanalyze(VacAttrStats *stats);
extern double anl_random_fract(void);
extern double anl_init_selection_state(int n);