mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Allow batching of inserts during cross-partition updates.
Commit927f453a9disallowed batching added by commitb663a4136to be used for the inserts performed as part of cross-partition updates of partitioned tables, mainly because the previous code in nodeModifyTable.c couldn't handle pending inserts into foreign-table partitions that are also UPDATE target partitions. But we don't have such a limitation anymore (cf. commitffbb7e65a), so let's allow for this by removing from execPartition.c the restriction added by commit927f453a9that batching is only allowed if the query command type is CMD_INSERT. In postgres_fdw, since commit86dc90056changed it to effectively disable cross-partition updates in the case where a foreign-table partition chosen to insert rows into is also an UPDATE target partition, allow batching in the case where a foreign-table partition chosen to do so is *not* also an UPDATE target partition. This is enabled by the "batch_size" option added by commitb663a4136, which is disabled by default. This patch also adjusts the test case added by commit927f453a9to confirm that the inserts performed as part of a cross-partition update of a partitioned table indeed uses batching. Amit Langote, reviewed and/or tested by Georgios Kokolatos, Zhihong Yu, Bharath Rupireddy, Hou Zhijie, Vignesh C, and me. Discussion: http://postgr.es/m/CA%2BHiwqH1Lz1yJmPs%3DaD-pzd_HLLynLHvq5iYeT9mB0bBV7oJ6w%40mail.gmail.com
This commit is contained in:
@@ -1018,8 +1018,7 @@ ExecInitRoutingInfo(ModifyTableState *mtstate,
|
||||
*
|
||||
* If the FDW does not support batching, we set the batch size to 1.
|
||||
*/
|
||||
if (mtstate->operation == CMD_INSERT &&
|
||||
partRelInfo->ri_FdwRoutine != NULL &&
|
||||
if (partRelInfo->ri_FdwRoutine != NULL &&
|
||||
partRelInfo->ri_FdwRoutine->GetForeignModifyBatchSize &&
|
||||
partRelInfo->ri_FdwRoutine->ExecForeignBatchInsert)
|
||||
partRelInfo->ri_BatchSize =
|
||||
|
||||
Reference in New Issue
Block a user