pgsql: Don't reuse slots between root and partition in ON CONFLICT ...

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't reuse slots between root and partition in ON CONFLICT ...
Date: 2019-03-06 23:51:13
Message-ID: E1h1gJd-0001KF-Sh@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/277cb789836b5ddf81aabb80c2058268c70e2f36

Modified Files
--------------
src/backend/executor/execPartition.c | 52 ++++++++++++++++++-------
src/backend/executor/nodeModifyTable.c | 70 ++++++++++++----------------------
src/include/nodes/execnodes.h | 5 +--
3 files changed, 64 insertions(+), 63 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-03-06 23:52:51 Re: pgsql: Removed unused variable, openLogOff.
Previous Message Andres Freund 2019-03-06 21:13:00 pgsql: Fix equalfuncs for accessMethod addition in 8586bf7ed8.