RE: POC: postgres_fdw insert batching
tsunakawa.takay@fujitsu.com <tsunakawa.takay@fujitsu.com>
From: "tsunakawa.takay@fujitsu.com" <tsunakawa.takay@fujitsu.com>
To: 'Amit Langote' <amitlangote09@gmail.com>, Tomas Vondra <tomas.vondra@enterprisedb.com>
Cc: "Andrey V. Lepikhov" <a.lepikhov@postgrespro.ru>, Tomas Vondra <tomas.vondra@2ndquadrant.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2021-01-15T14:59:55Z
Lists: pgsql-hackers
From: Amit Langote <amitlangote09@gmail.com> > Okay, so maybe not moving the whole logic into the FDW's > BeginForeignModify(), but at least if we move this... > > @@ -441,6 +449,72 @@ ExecInsert(ModifyTableState *mtstate, > + /* > + * Determine if the FDW supports batch insert and determine the > batch > + * size (a FDW may support batching, but it may be disabled for the > + * server/table). Do this only once, at the beginning - we don't want > + * the batch size to change during execution. > + */ > + if (resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize && > + resultRelInfo->ri_FdwRoutine->ExecForeignBatchInsert && > + resultRelInfo->ri_BatchSize == 0) > + resultRelInfo->ri_BatchSize = > + > resultRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize(resultRelInfo); > > ...into ExecInitModifyTable(), ExecInsert() only needs the following block: Does ExecInitModifyTable() know all leaf partitions where the tuples produced by VALUES or SELECT go? ExecInsert() doesn't find the target leaf partition for the first time through the call to ExecPrepareTupleRouting()? Leaf partitions can have different batch_size settings. 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