1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

Introduce IndexAM fields for parallel vacuum.

Introduce new fields amusemaintenanceworkmem and amparallelvacuumoptions
in IndexAmRoutine for parallel vacuum.  The amusemaintenanceworkmem tells
whether a particular IndexAM uses maintenance_work_mem or not.  This will
help in controlling the memory used by individual workers as otherwise,
each worker can consume memory equal to maintenance_work_mem.  The
amparallelvacuumoptions tell whether a particular IndexAM participates in
a parallel vacuum and if so in which phase (bulkdelete, vacuumcleanup) of
vacuum.

Author: Masahiko Sawada and Amit Kapila
Reviewed-by: Dilip Kumar, Amit Kapila, Tomas Vondra and Robert Haas
Discussion:
https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com
https://postgr.es/m/CAA4eK1LmcD5aPogzwim5Nn58Ki+74a6Edghx4Wd8hAskvHaq5A@mail.gmail.com
This commit is contained in:
Amit Kapila
2020-01-15 07:24:14 +05:30
parent fe233366f2
commit 4d8a8d0c73
11 changed files with 75 additions and 0 deletions

View File

@@ -23,6 +23,44 @@
#include "storage/lock.h"
#include "utils/relcache.h"
/*
* Flags for amparallelvacuumoptions to control the participation of bulkdelete
* and vacuumcleanup in parallel vacuum.
*/
/*
* Both bulkdelete and vacuumcleanup are disabled by default. This will be
* used by IndexAM's that don't want to or cannot participate in parallel
* vacuum. For example, if an index AM doesn't have a way to communicate the
* index statistics allocated by the first ambulkdelete call to the subsequent
* ones until amvacuumcleanup, the index AM cannot participate in parallel
* vacuum.
*/
#define VACUUM_OPTION_NO_PARALLEL 0
/*
* bulkdelete can be performed in parallel. This option can be used by
* IndexAm's that need to scan the index to delete the tuples.
*/
#define VACUUM_OPTION_PARALLEL_BULKDEL (1 << 0)
/*
* vacuumcleanup can be performed in parallel if bulkdelete is not performed
* yet. This will be used by IndexAM's that can scan the index if the
* bulkdelete is not performed.
*/
#define VACUUM_OPTION_PARALLEL_COND_CLEANUP (1 << 1)
/*
* vacuumcleanup can be performed in parallel even if bulkdelete has already
* processed the index. This will be used by IndexAM's that scan the index
* during the cleanup phase of index irrespective of whether the index is
* already scanned or not during bulkdelete phase.
*/
#define VACUUM_OPTION_PARALLEL_CLEANUP (1 << 2)
/* value for checking vacuum flags */
#define VACUUM_OPTION_MAX_VALID_VALUE ((1 << 3) - 1)
/*----------
* ANALYZE builds one of these structs for each attribute (column) that is