diff options
author | Andres Freund <andres@anarazel.de> | 2019-03-06 15:43:33 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-03-06 15:43:33 -0800 |
commit | 277cb789836b5ddf81aabb80c2058268c70e2f36 (patch) | |
tree | 92b675a011892e1317b095ed25c4c6557116ad07 /src/include/nodes/execnodes.h | |
parent | d16a74c20ce3485d43902b0b1fb8ec1c11ec84a5 (diff) | |
download | postgresql-277cb789836b5ddf81aabb80c2058268c70e2f36.tar.gz postgresql-277cb789836b5ddf81aabb80c2058268c70e2f36.zip |
Don't reuse slots between root and partition in ON CONFLICT ... UPDATE.
Until now the the slot to store the conflicting tuple, and the result
of the ON CONFLICT SET, where reused between partitions. That
necessitated changing slots descriptor when switching partitions.
Besides the overhead of switching descriptors on a slot (which
requires memory allocations and prevents JITing), that's importantly
also problematic for tableam. There individual partitions might belong
to different tableams, needing different kinds of slots.
In passing also fix ExecOnConflictUpdate to clear the existing slot at
exit. Otherwise that slot could continue to hold a pin till the query
ends, which could be far too long if the input data set is large, and
there's no further conflicts. While previously also problematic, it's
now more important as there will be more such slots when partitioned.
Author: Andres Freund
Reviewed-By: Robert Haas, David Rowley
Discussion: https://postgr.es/m/20180703070645.wchpu5muyto5n647@alap3.anarazel.de
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r-- | src/include/nodes/execnodes.h | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 996d872c562..6a5411eba8c 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -377,8 +377,9 @@ typedef struct OnConflictSetState { NodeTag type; + TupleTableSlot *oc_Existing; /* slot to store existing target tuple in */ + TupleTableSlot *oc_ProjSlot; /* CONFLICT ... SET ... projection target */ ProjectionInfo *oc_ProjInfo; /* for ON CONFLICT DO UPDATE SET */ - TupleDesc oc_ProjTupdesc; /* TupleDesc for the above projection */ ExprState *oc_WhereClause; /* state for the WHERE clause */ } OnConflictSetState; @@ -1109,9 +1110,7 @@ typedef struct ModifyTableState List **mt_arowmarks; /* per-subplan ExecAuxRowMark lists */ EPQState mt_epqstate; /* for evaluating EvalPlanQual rechecks */ bool fireBSTriggers; /* do we need to fire stmt triggers? */ - TupleTableSlot *mt_existing; /* slot to store existing target tuple in */ List *mt_excludedtlist; /* the excluded pseudo relation's tlist */ - TupleTableSlot *mt_conflproj; /* CONFLICT ... SET ... projection target */ /* * Slot for storing tuples in the root partitioned table's rowtype during |