]> granicus.if.org Git - postgresql/commit
Don't reuse slots between root and partition in ON CONFLICT ... UPDATE.
authorAndres Freund <andres@anarazel.de>
Wed, 6 Mar 2019 23:43:33 +0000 (15:43 -0800)
committerAndres Freund <andres@anarazel.de>
Wed, 6 Mar 2019 23:43:33 +0000 (15:43 -0800)
commit277cb789836b5ddf81aabb80c2058268c70e2f36
tree92b675a011892e1317b095ed25c4c6557116ad07
parentd16a74c20ce3485d43902b0b1fb8ec1c11ec84a5
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
src/backend/executor/execPartition.c
src/backend/executor/nodeModifyTable.c
src/include/nodes/execnodes.h