From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Andres Freund <andres@anarazel.de>
Cc: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Cc: Peter Geoghegan <pg@bowt.ie>
Subject: Re: ON CONFLICT DO UPDATE for partitioned tables
Date: Fri, 16 Mar 2018 18:46:17 -0300
Message-ID: <20180316214617.dpunmkhhjhvgfxpi@alvherre.pgsql> (raw)
In-Reply-To: <20180316212851.erj4dwmz3ubq3kiq@alap3.anarazel.de>
Andres Freund wrote:
> Hi,
>
> On 2018-03-16 18:23:44 -0300, Alvaro Herrera wrote:
> > Another thing I noticed is that the split of the ON CONFLICT slot and
> > its corresponding projection is pretty weird. The projection is in
> > ResultRelInfo, but the slot itself is in ModifyTableState. You can't
> > make the projection work without a corresponding slot initialized with
> > the correct descriptor, so splitting it this way doesn't make a lot of
> > sense to me.
> >
> > (Now, TBH the split between resultRelInfo->ri_projectReturning and
> > ModifyTableState->ps.ps_ResultTupleSlot, which is the slot that the
> > returning project uses, doesn't make a lot of sense to me either; so
> > maybe there some reason that I'm just not seeing. But I digress.)
>
> The projections for different child tables / child plans can look
> different, therefore it can't be stored in ModifyTableState itself. No?
>
> The slot's descriptor is changed to be "appropriate" when necessary:
> if (slot->tts_tupleDescriptor != RelationGetDescr(resultRelationDesc))
> ExecSetSlotDescriptor(slot, RelationGetDescr(resultRelationDesc));
Grumble. This stuff looks like full of cheats to me, but I won't touch
it anyway.
> > So I want to propose that we move the slot to be together with the
> > projection node that it serves, ie. we put the slot in ResultRelInfo:
>
> That'll mean we have a good number of additional slots in some cases. I
> don't think the overhead of that is going to break the bank, but it's
> worth considering.
Good point.
I think what I should be doing is the same as the returning stuff: keep
a tupdesc around, and use a single slot, whose descriptor is changed
just before the projection.
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
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 using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, andres@anarazel.de, pavan.deolasee@gmail.com, fujita.etsuro@lab.ntt.co.jp, Langote_Amit_f8@lab.ntt.co.jp, pg@bowt.ie
Subject: Re: ON CONFLICT DO UPDATE for partitioned tables
In-Reply-To: <20180316214617.dpunmkhhjhvgfxpi@alvherre.pgsql>
* 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