Re: POC: postgres_fdw insert batching
Amit Langote <amitlangote09@gmail.com>
From: Amit Langote <amitlangote09@gmail.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>,
Zhihong Yu <zyu@yugabyte.com>, "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>,
Tomas Vondra <tomas.vondra@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-02-16T09:25:25Z
Lists: pgsql-hackers
Attachments
- v4-0001-Fix-tuple-routing-to-initialize-batching-only-for.patch (application/x-patch) patch v4-0001
On Tue, Feb 16, 2021 at 1:36 AM Tomas Vondra <tomas.vondra@enterprisedb.com> wrote: > On 2/5/21 3:52 AM, Amit Langote wrote: > > Tsunakwa-san, > > > > On Mon, Jan 25, 2021 at 1:21 PM tsunakawa.takay@fujitsu.com > > <tsunakawa.takay@fujitsu.com> wrote: > >> From: Amit Langote <amitlangote09@gmail.com> > >>> Yes, it can be simplified by using a local join to prevent the update of the foreign > >>> partition from being pushed to the remote server, for which my example in the > >>> previous email used a local trigger. Note that the update of the foreign > >>> partition to be done locally is a prerequisite for this bug to occur. > >> > >> Thank you, I was aware that UPDATE calls ExecInsert() but forgot about it partway. Good catch (and my bad miss.) > > > > It appears I had missed your reply, sorry. > > > >> + PgFdwModifyState *fmstate = resultRelInfo->ri_FdwState ? > >> + (PgFdwModifyState *) resultRelInfo->ri_FdwState : > >> + NULL; > >> > >> This can be written as: > >> > >> + PgFdwModifyState *fmstate = (PgFdwModifyState *) resultRelInfo->ri_FdwState; > > > > Facepalm, yes. > > > > Patch updated. Thanks for the review. > > > > Thanks for the patch, it seems fine to me. Thanks for checking. > I wonder it the commit > message needs some tweaks, though. At the moment it says: > > Prevent FDW insert batching during cross-partition updates > > but what the patch seems to be doing is simply initializing the info > only for CMD_INSERT operations. Which does the trick, but it affects > everything, i.e. all updates, no? Not just cross-partition updates. You're right. Please check the message in the updated patch. -- Amit Langote EDB: http://www.enterprisedb.com
Commits
-
Fix tuple routing to initialize batching only for inserts
- 927f453a9410 14.0 landed
-
Fix pointer type in ExecForeignBatchInsert SGML docs
- c15283ff429b 14.0 landed
-
Fix initialization of FDW batching in ExecInitModifyTable
- 920f853dc948 14.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 landed