mirror of
https://github.com/postgres/postgres.git
synced 2025-11-10 17:42:29 +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:
@@ -27,6 +27,7 @@
|
||||
#include "access/xloginsert.h"
|
||||
#include "catalog/index.h"
|
||||
#include "catalog/pg_am.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "miscadmin.h"
|
||||
#include "pgstat.h"
|
||||
#include "postmaster/autovacuum.h"
|
||||
@@ -101,6 +102,9 @@ brinhandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = false;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcaninclude = false;
|
||||
amroutine->amusemaintenanceworkmem = false;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_CLEANUP;
|
||||
amroutine->amkeytype = InvalidOid;
|
||||
|
||||
amroutine->ambuild = brinbuild;
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "access/xloginsert.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "catalog/pg_type.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "miscadmin.h"
|
||||
#include "storage/indexfsm.h"
|
||||
#include "storage/lmgr.h"
|
||||
@@ -53,6 +54,9 @@ ginhandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = true;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcaninclude = false;
|
||||
amroutine->amusemaintenanceworkmem = true;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_CLEANUP;
|
||||
amroutine->amkeytype = InvalidOid;
|
||||
|
||||
amroutine->ambuild = ginbuild;
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "access/gist_private.h"
|
||||
#include "access/gistscan.h"
|
||||
#include "catalog/pg_collation.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "miscadmin.h"
|
||||
#include "nodes/execnodes.h"
|
||||
#include "storage/lmgr.h"
|
||||
@@ -74,6 +75,9 @@ gisthandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = true;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcaninclude = true;
|
||||
amroutine->amusemaintenanceworkmem = false;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_COND_CLEANUP;
|
||||
amroutine->amkeytype = InvalidOid;
|
||||
|
||||
amroutine->ambuild = gistbuild;
|
||||
|
||||
@@ -72,6 +72,9 @@ hashhandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = true;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcaninclude = false;
|
||||
amroutine->amusemaintenanceworkmem = false;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_BULKDEL;
|
||||
amroutine->amkeytype = INT4OID;
|
||||
|
||||
amroutine->ambuild = hashbuild;
|
||||
|
||||
@@ -121,6 +121,9 @@ bthandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = true;
|
||||
amroutine->amcanparallel = true;
|
||||
amroutine->amcaninclude = true;
|
||||
amroutine->amusemaintenanceworkmem = false;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_COND_CLEANUP;
|
||||
amroutine->amkeytype = InvalidOid;
|
||||
|
||||
amroutine->ambuild = btbuild;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "access/transam.h"
|
||||
#include "access/xact.h"
|
||||
#include "catalog/pg_amop.h"
|
||||
#include "commands/vacuum.h"
|
||||
#include "storage/bufmgr.h"
|
||||
#include "storage/indexfsm.h"
|
||||
#include "storage/lmgr.h"
|
||||
@@ -56,6 +57,9 @@ spghandler(PG_FUNCTION_ARGS)
|
||||
amroutine->ampredlocks = false;
|
||||
amroutine->amcanparallel = false;
|
||||
amroutine->amcaninclude = false;
|
||||
amroutine->amusemaintenanceworkmem = false;
|
||||
amroutine->amparallelvacuumoptions =
|
||||
VACUUM_OPTION_PARALLEL_BULKDEL | VACUUM_OPTION_PARALLEL_COND_CLEANUP;
|
||||
amroutine->amkeytype = InvalidOid;
|
||||
|
||||
amroutine->ambuild = spgbuild;
|
||||
|
||||
Reference in New Issue
Block a user