RE: Fast COPY FROM based on batch insert

From: "tsunakawa(dot)takay(at)fujitsu(dot)com" <tsunakawa(dot)takay(at)fujitsu(dot)com>
To: 'Andrey Lepikhov' <a(dot)lepikhov(at)postgrespro(dot)ru>
Cc: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, "tanghy(dot)fnst(at)fujitsu(dot)com" <tanghy(dot)fnst(at)fujitsu(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>
Subject: RE: Fast COPY FROM based on batch insert
Date: 2021-06-04 08:45:55
Message-ID: TYAPR01MB2990ECA064C09DD3E4A0CA27FE3B9@TYAPR01MB2990.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

From: Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
> We still have slow 'COPY FROM' operation for foreign tables in current master.
> Now we have a foreign batch insert operation And I tried to rewrite the patch [1]
> with this machinery.

I haven't looked at the patch, but nice performance.

However, I see the following problems. What do you think about them?

1)
No wonder why the user would think like "Why are INSERTs run on the remote server? I ran COPY."

2)
Without the FDW API for COPY, other FDWs won't get a chance to optimize for bulk data loading. For example, oracle_fdw might use conventional path insert for the FDW batch insert, and the direct path insert for the FDW COPY.

3)
INSERT and COPY in Postgres differs in whether the rule is invoked:

https://www.postgresql.org/docs/devel/sql-copy.html

"COPY FROM will invoke any triggers and check constraints on the destination table. However, it will not invoke rules."

Regards
Takayuki Tsunakawa

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message tsunakawa.takay@fujitsu.com 2021-06-04 08:59:29 RE: Transactions involving multiple postgres foreign servers, take 2
Previous Message Masahiko Sawada 2021-06-04 08:43:46 Re: Transactions involving multiple postgres foreign servers, take 2