Re: Allow batched insert during cross-partition updates

Zhihong Yu <zyu@yugabyte.com>

From: Zhihong Yu <zyu@yugabyte.com>
To: Amit Langote <amitlangote09@gmail.com>
Cc: gkokolatos@pm.me, PostgreSQL-development <pgsql-hackers@postgresql.org>, Tomas Vondra <tomas.vondra@enterprisedb.com>, "Tsunakawa, Takayuki" <tsunakawa.takay@fujitsu.com>
Date: 2021-04-04T16:19:27Z
Lists: pgsql-hackers
Hi,
In the description:

cross-partition update of partitioned tables can't use batching
because ExecInitRoutingInfo() which initializes the insert target

'which' should be dropped since 'because' should start a sentence.

+-- Check that batched inserts also works for inserts made during

inserts also works -> inserts also work

+       Assert(node->rootResultRelInfo->ri_RelationDesc->rd_rel->relkind ==
+              RELKIND_PARTITIONED_TABLE);

The level of nested field accesses is quite deep. If the assertion fails,
it would be hard to know which field is null.
Maybe use several assertions:
       Assert(node->rootResultRelInfo)
       Assert(node->rootResultRelInfo->ri_RelationDesc)
       Assert(node->rootResultRelInfo->ri_RelationDesc->rd_rel->relkind ==
...

Cheers

On Sun, Apr 4, 2021 at 8:06 AM Amit Langote <amitlangote09@gmail.com> wrote:

> On Tue, Mar 16, 2021 at 6:13 PM <gkokolatos@pm.me> wrote:
> > Status updated to RfC in the commitfest app.
>
> Patch fails to apply per cfbot, so rebased.
>
> --
> Amit Langote
> EDB: http://www.enterprisedb.com
>

Commits

  1. Allow batching of inserts during cross-partition updates.

  2. Fix handling of pending inserts in nodeModifyTable.c.

  3. Postpone some stuff out of ExecInitModifyTable.

  4. Fix tuple routing to initialize batching only for inserts