From 43d1ed60fdd96027f044e152176c0d45cd6bf443 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Fri, 30 Mar 2018 14:23:17 +0300 Subject: Predicate locking in GIN index Predicate locks are used on per page basis only if fastupdate = off, in opposite case predicate lock on pending list will effectively lock whole index, to reduce locking overhead, just lock a relation. Entry and posting trees are essentially B-tree, so locks are acquired on leaf pages only. Author: Shubham Barai with some editorization by me and Dmitry Ivanov Review by: Alexander Korotkov, Dmitry Ivanov, Fedor Sigaev Discussion: https://www.postgresql.org/message-id/flat/CALxAEPt5sWW+EwTaKUGFL5_XFcZ0MuGBcyJ70oqbWqr42YKR8Q@mail.gmail.com --- src/backend/access/gin/ginutil.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/backend/access/gin/ginutil.c') diff --git a/src/backend/access/gin/ginutil.c b/src/backend/access/gin/ginutil.c index 7bac7a12521..5632cc5a773 100644 --- a/src/backend/access/gin/ginutil.c +++ b/src/backend/access/gin/ginutil.c @@ -23,6 +23,7 @@ #include "miscadmin.h" #include "storage/indexfsm.h" #include "storage/lmgr.h" +#include "storage/predicate.h" #include "utils/builtins.h" #include "utils/index_selfuncs.h" #include "utils/typcache.h" @@ -49,7 +50,7 @@ ginhandler(PG_FUNCTION_ARGS) amroutine->amsearchnulls = false; amroutine->amstorage = true; amroutine->amclusterable = false; - amroutine->ampredlocks = false; + amroutine->ampredlocks = true; amroutine->amcanparallel = false; amroutine->amkeytype = InvalidOid; @@ -716,3 +717,10 @@ ginUpdateStats(Relation index, const GinStatsData *stats) END_CRIT_SECTION(); } + +void +GinCheckForSerializableConflictIn(Relation relation, HeapTuple tuple, Buffer buffer) +{ + if (!GinGetUseFastUpdate(relation)) + CheckForSerializableConflictIn(relation, tuple, buffer); +} -- cgit v1.2.3