From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Don't reuse slots between root and partition in ON CONFLICT ...
Date: Wed, 06 Mar 2019 23:51:13 +0000
Message-ID: <E1h1gJd-0001KF-Sh@gemulon.postgresql.org> (raw)
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(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: andres@anarazel.de
Subject: Re: pgsql: Don't reuse slots between root and partition in ON CONFLICT ...
In-Reply-To: <E1h1gJd-0001KF-Sh@gemulon.postgresql.org>
References: <E1h1gJd-0001KF-Sh@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox