RE: POC: postgres_fdw insert batching
tsunakawa.takay@fujitsu.com <tsunakawa.takay@fujitsu.com>
From: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
To: Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: 'Amit Langote' <amitlangote09@gmail.com>, "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-01-18T06:51:45Z
Lists: pgsql-hackers
Attachments
- v10-0001-Add-bulk-insert-for-foreign-tables.patch (application/octet-stream) patch v10-0001
Tomas-san, From: Amit Langote <amitlangote09@gmail.com> > Good thing you reminded me that this is about inserts, and in that > case no, ExecInitModifyTable() doesn't know all leaf partitions, it > only sees the root table whose batch_size doesn't really matter. So > it's really ExecInitRoutingInfo() that I would recommend to set > ri_BatchSize; right after this block: > > /* > * If the partition is a foreign table, let the FDW init itself for > * routing tuples to the partition. > */ > if (partRelInfo->ri_FdwRoutine != NULL && > partRelInfo->ri_FdwRoutine->BeginForeignInsert != NULL) > partRelInfo->ri_FdwRoutine->BeginForeignInsert(mtstate, partRelInfo); > > Note that ExecInitRoutingInfo() is called only once for a partition > when it is initialized after being inserted into for the first time. > > For a non-partitioned targets, I'd still say set ri_BatchSize in > ExecInitModifyTable(). Attached is the patch that added call to GetModifyBatchSize() to the above two places. The regression test passes. (FWIW, frankly, I prefer the previous version because the code is a bit smaller... Maybe we should refactor the code someday to reduce similar processings in both the partitioned case and non-partitioned case.) Regards Takayuki Tsunakawa
Commits
-
Fix tuple routing to initialize batching only for inserts
- 927f453a9410 14.0 landed
-
Fix pointer type in ExecForeignBatchInsert SGML docs
- c15283ff429b 14.0 landed
-
Fix initialization of FDW batching in ExecInitModifyTable
- 920f853dc948 14.0 landed
-
Implement support for bulk inserts in postgres_fdw
- b663a4136331 14.0 landed