Based on the discussion at: https://www.postgresql.org/message-id/6929d485-2d2a-da46-3681-4a400a3d794f%40enterprisedb.com
I'm posting the patch for $subject here in this new thread and I'll add it to the next CF per Tomas' advice. With 927f453a94106 committed earlier today, we limit insert batching only to the cases where the query's main command is also insert, because allowing it to be used in other cases can hit some limitations of the current code. One such case is cross-partition updates of a partitioned table which internally uses insert. postgres_fdw supports some cases where a row is moved from a local partition to a foreign partition. When doing so, the moved row is inserted into the latter, but those inserts can't use batching due to the aforementioned commit. As described in the thread linked above, to make batching possible for those internal inserts, we'd need to make some changes to both the core code and postgres_fdw, which the attached patch implements. Details are in the commit message. -- Amit Langote EDB: http://www.enterprisedb.com
v1-0001-Allow-batching-of-inserts-during-cross-partition-.patch
Description: Binary data