From 8b0e75e69be6f34757dcaa43d8b73037365297a0 Mon Sep 17 00:00:00 2001 From: Masahiko Sawada Date: Tue, 15 Oct 2019 17:03:22 +0900 Subject: [PATCH v30 1/3] Add a index AM field to check parallel index participation gist indexes don't support parallel index vacuuming for now since it returns larger structure of which IndexBulkDelete is just the first field from bulkdelete. --- contrib/bloom/blutils.c | 1 + doc/src/sgml/indexam.sgml | 2 ++ src/backend/access/brin/brin.c | 1 + src/backend/access/gist/gist.c | 1 + src/backend/access/hash/hash.c | 1 + src/backend/access/nbtree/nbtree.c | 1 + src/backend/access/spgist/spgutils.c | 1 + src/include/access/amapi.h | 2 ++ 8 files changed, 10 insertions(+) diff --git a/contrib/bloom/blutils.c b/contrib/bloom/blutils.c index dbb24cb5b2..6dbfca0f4a 100644 --- a/contrib/bloom/blutils.c +++ b/contrib/bloom/blutils.c @@ -122,6 +122,7 @@ blhandler(PG_FUNCTION_ARGS) amroutine->amclusterable = false; amroutine->ampredlocks = false; amroutine->amcanparallel = false; + amroutine->amcanparallelvacuum = true; amroutine->amcaninclude = false; amroutine->amkeytype = InvalidOid; diff --git a/doc/src/sgml/indexam.sgml b/doc/src/sgml/indexam.sgml index dd54c68802..fa5682db04 100644 --- a/doc/src/sgml/indexam.sgml +++ b/doc/src/sgml/indexam.sgml @@ -120,6 +120,8 @@ typedef struct IndexAmRoutine bool ampredlocks; /* does AM support parallel scan? */ bool amcanparallel; + /* does AM support parallel vacuum? */ + bool amcanparallelvacuum; /* does AM support columns included with clause INCLUDE? */ bool amcaninclude; /* type of data stored in index, or InvalidOid if variable */ diff --git a/src/backend/access/brin/brin.c b/src/backend/access/brin/brin.c index ae7b729edd..6ea48fb555 100644 --- a/src/backend/access/brin/brin.c +++ b/src/backend/access/brin/brin.c @@ -100,6 +100,7 @@ brinhandler(PG_FUNCTION_ARGS) amroutine->amclusterable = false; amroutine->ampredlocks = false; amroutine->amcanparallel = false; + amroutine->amcanparallelvacuum = true; amroutine->amcaninclude = false; amroutine->amkeytype = InvalidOid; diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 0cc87911d6..f44c2fd2ff 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -74,6 +74,7 @@ gisthandler(PG_FUNCTION_ARGS) amroutine->amclusterable = true; amroutine->ampredlocks = true; amroutine->amcanparallel = false; + amroutine->amcanparallelvacuum = false; amroutine->amcaninclude = true; amroutine->amkeytype = InvalidOid; diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 5cc30dac42..f21d9ac78f 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -73,6 +73,7 @@ hashhandler(PG_FUNCTION_ARGS) amroutine->amclusterable = false; amroutine->ampredlocks = true; amroutine->amcanparallel = false; + amroutine->amcanparallelvacuum = true; amroutine->amcaninclude = false; amroutine->amkeytype = INT4OID; diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 4cfd5289ad..e885aadc21 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -122,6 +122,7 @@ bthandler(PG_FUNCTION_ARGS) amroutine->amclusterable = true; amroutine->ampredlocks = true; amroutine->amcanparallel = true; + amroutine->amcanparallelvacuum = true; amroutine->amcaninclude = true; amroutine->amkeytype = InvalidOid; diff --git a/src/backend/access/spgist/spgutils.c b/src/backend/access/spgist/spgutils.c index 45472db147..0c86b63f65 100644 --- a/src/backend/access/spgist/spgutils.c +++ b/src/backend/access/spgist/spgutils.c @@ -55,6 +55,7 @@ spghandler(PG_FUNCTION_ARGS) amroutine->amclusterable = false; amroutine->ampredlocks = false; amroutine->amcanparallel = false; + amroutine->amcanparallelvacuum = true; amroutine->amcaninclude = false; amroutine->amkeytype = InvalidOid; diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index 6e3db06eed..f7d2a1b7e3 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -195,6 +195,8 @@ typedef struct IndexAmRoutine bool ampredlocks; /* does AM support parallel scan? */ bool amcanparallel; + /* does AM support parallel vacuum? */ + bool amcanparallelvacuum; /* does AM support columns included with clause INCLUDE? */ bool amcaninclude; /* type of data stored in index, or InvalidOid if variable */ -- 2.22.0