Allow batched insert during cross-partition updates

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)fujitsu(dot)com>
Subject: Allow batched insert during cross-partition updates
Date: 2021-02-18 09:52:36
Message-ID: CA+HiwqH1Lz1yJmPs=aD-pzd_HLLynLHvq5iYeT9mB0bBV7oJ6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Based on the discussion at:

https://www.postgresql.org/message-id/6929d485-2d2a-da46-3681-4a400a3d794f%40enterprisedb.com

I'm posting the patch for $subject here in this new thread and I'll
add it to the next CF per Tomas' advice.

With 927f453a94106 committed earlier today, we limit insert batching
only to the cases where the query's main command is also insert,
because allowing it to be used in other cases can hit some limitations
of the current code.

One such case is cross-partition updates of a partitioned table which
internally uses insert. postgres_fdw supports some cases where a row
is moved from a local partition to a foreign partition. When doing
so, the moved row is inserted into the latter, but those inserts can't
use batching due to the aforementioned commit.

As described in the thread linked above, to make batching possible for
those internal inserts, we'd need to make some changes to both the
core code and postgres_fdw, which the attached patch implements.
Details are in the commit message.

--
Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
v1-0001-Allow-batching-of-inserts-during-cross-partition-.patch application/octet-stream 11.7 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2021-02-18 09:54:44 Re: Allow batched insert during cross-partition updates
Previous Message Amit Langote 2021-02-18 09:21:53 Re: A reloption for partitioned tables - parallel_workers