Re: [POC] Fast COPY FROM command for the table with foreign partitions

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>
To: Amit Langote <amitlangote09@gmail.com>, "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
Cc: Alexey Kondratov <a.kondratov@postgrespro.ru>, Michael Paquier <michael@paquier.xyz>, Ashutosh Bapat <ashutosh.bapat@2ndquadrant.com>, Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>, Etsuro Fujita <etsuro.fujita@gmail.com>, PostgreSQL-Dev <pgsql-hackers@postgresql.org>
Date: 2020-12-14T09:06:12Z
Lists: pgsql-hackers

Attachments

On 12/1/20 2:02 PM, Amit Langote wrote:
> On Tue, Dec 1, 2020 at 2:40 PM tsunakawa.takay@fujitsu.com
> <tsunakawa.takay@fujitsu.com> wrote:
>> From: Amit Langote <amitlangote09@gmail.com>
 >> The code appears to require both BeginForeignCopy and EndForeignCopy,
 >> while the following documentation says they are optional.  Which is
 >> correct?  (I suppose the latter is correct just like other existing
 >> Begin/End functions are optional.)

Fixed.

 > Anyway, one thing we could do is rename
 > ExecRelationAllowsMultiInsert() to ExecSetRelationUsesMultiInsert(

Renamed.

 >> I agree with your idea of adding multi_insert argument to 
ExecFindPartition() to request a multi-insert-capable partition.  At 
first, I thought ExecFindPartition() is used for all operations, 
insert/delete/update/select, so I found it odd to add multi_insert 
argument.  But ExecFindPartion() is used only for insert, so 
multi_insert argument seems okay.
 >
 > Good.  Andrey, any thoughts on this?

I have no serious technical arguments against this, other than code 
readability and reduce of a routine parameters. Maybe we will be 
rethinking it later?

The new version rebased on commit 525e60b742 is attached.


-- 
regards,
Andrey Lepikhov
Postgres Professional

Commits

  1. Allow batch insertion during COPY into a foreign table.

  2. postgres_fdw: Disable batch insertion when there are WCO constraints.

  3. Enforce foreign key correctly during cross-partition updates

  4. Fix permission checks on constraint violation errors on partitions.

  5. Fix compilation of uuid-ossp