Re: ModifyTable overheads in generic plans

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Amit Langote <amitlangote09(at)gmail(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, David Rowley <dgrowleyml(at)gmail(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
Subject: Re: ModifyTable overheads in generic plans
Date: 2020-11-11 08:55:46
Message-ID: 1d2633ba-00a0-a688-3891-654bbde56a34@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/11/2020 17:32, Heikki Linnakangas wrote:
> On 10/11/2020 13:12, Amit Langote wrote:
>> On second thought, it seems A would amount to merely a cosmetic
>> adjustment of the API, nothing more. B seems to get the job done for
>> me and also doesn't unnecessarily break compatibility, so I've updated
>> 0001 to implement B. Please give it a look.
>
> Looks good at a quick glance. It is a small API break that
> BeginDirectModify() is now called during execution, not at executor
> startup, but I don't think that's going to break FDWs in practice. One
> could argue, though, that if we're going to change the API, we should do
> it more loudly. So changing the arguments might be a good thing.
>
> The BeginDirectModify() and BeginForeignModify() interfaces are
> inconsistent, but that's not this patch's fault. I wonder if we could
> move the call to BeginForeignModify() also to ForeignNext(), though? And
> BeginForeignScan() too, while we're at it.

With these patches, BeginForeignModify() and BeginDirectModify() are
both called during execution, before the first
IterateForeignScan/IterateDirectModify call. The documentation for
BeginForeignModify() needs to be updated, it still claims that it's run
at executor startup, but that's not true after these patches. So that
needs to be updated.

I think that's a good thing, because it means that BeginForeignModify()
and BeginDirectModify() are called at the same stage, from the FDW's
point of view. Even though BeginDirectModify() is called from
ForeignNext(), and BeginForeignModify() from ExecModifyTable(), that
difference isn't visible to the FDW; both are after executor startup but
before the first Iterate call.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2020-11-11 08:57:15 Re: Background writer and checkpointer in crash recovery
Previous Message Kyotaro Horiguchi 2020-11-11 08:35:21 Re: Disable WAL logging to speed up data loading