From: Justin Pryzby Date: Tue, 1 Dec 2020 17:20:25 -0600 Subject: [PATCH v9 4/4] WIP: check tuple size Or maybe INSERT should flush buffer based only on the *number* of tuples, and not their size ? --- src/backend/executor/nodeModifyTable.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/backend/executor/nodeModifyTable.c b/src/backend/executor/nodeModifyTable.c index 2059428e2a..04b0598183 100644 --- a/src/backend/executor/nodeModifyTable.c +++ b/src/backend/executor/nodeModifyTable.c @@ -703,7 +703,13 @@ ExecInsert(ModifyTableState *mtstate, batchslot = MultiInsertInfoNextFreeSlot(mtstate->miinfo, resultRelInfo); ExecCopySlot(batchslot, slot); - MultiInsertInfoStore(mtstate->miinfo, resultRelInfo, batchslot, 0, 0); // XXX: tuplen/lineno + MultiInsertInfoStore(mtstate->miinfo, resultRelInfo, batchslot, + // sizeof(void*) * batchslot->tts_nvalid, /* tuple size - underestimate */ + MemoryContextMemAllocated(batchslot->tts_mcxt, true), /* tuple size */ + mtstate->ntuples); /* lineno */ + + elog(DEBUG2, "bufferedBytes %d; tuples %ld", + mtstate->miinfo->bufferedBytes, mtstate->ntuples); if (MultiInsertInfoIsFull(mtstate->miinfo)) MultiInsertInfoFlush(mtstate->miinfo, resultRelInfo); -- 2.17.0 --3yNHWXBV/QO9xKNm--