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: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
Cc: "tanghy.fnst@cn.fujitsu.com" <tanghy.fnst@cn.fujitsu.com>,
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>,
Tomas Vondra <tomas.vondra@enterprisedb.com>,
"houzj.fnst@cn.fujitsu.com" <houzj.fnst@cn.fujitsu.com>,
Amit Langote <amitlangote09@gmail.com>
Date: 2021-02-09T08:22:33Z
Lists: pgsql-hackers
On 2/9/21 12:47 PM, tsunakawa.takay@fujitsu.com wrote: > From: Andrey V. Lepikhov <a.lepikhov@postgrespro.ru> > I guess you used many hash partitions. Sadly, The current COPY implementation only accumulates either 1,000 rows or 64 KB of input data (very small!) before flushing all CopyMultiInsertBuffers. One CopyMultiInsertBuffer corresponds to one partition. Flushing a CopyMultiInsertBuffer calls ExecForeignCopy() once, which connects to a remote database, runs COPY FROM STDIN, and disconnects. Here, the flushing trigger (1,000 rows or 64 KB input data, whichever comes first) is so small that if there are many target partitions, the amount of data for each partition is small. I tried to use 1E4 - 1E8 rows in a tuple buffer. But the results weren't impressive. We can use one more GUC instead of a precompiled constant. > Why don't we focus on committing the basic part and addressing the extended part (0003 and 0004) separately later? I focused only on the 0001 and 0002 patches. > As Tang-san and you showed, the basic part already demonstrated impressive improvement. If there's no objection, I'd like to make this ready for committer in a few days. Good. -- regards, Andrey Lepikhov Postgres Professional
Commits
-
Allow batch insertion during COPY into a foreign table.
- 97da48246d34 16.0 landed
-
postgres_fdw: Disable batch insertion when there are WCO constraints.
- 82593b9a3d5f 16.0 cited
-
Enforce foreign key correctly during cross-partition updates
- ba9a7e392171 15.0 cited
-
Fix permission checks on constraint violation errors on partitions.
- 6214e2b22804 14.0 cited
-
Fix compilation of uuid-ossp
- 525e60b74299 14.0 cited