未验证 提交 9a0e6ab6 编写于 作者: P Paul Guo 提交者: GitHub

Replace ExecFetchSlotHeapTuple()+heap_copytuple() with ExecCopySlotHeapTuple()...

Replace ExecFetchSlotHeapTuple()+heap_copytuple() with ExecCopySlotHeapTuple() in CopyFrom() (#9261)

This saves a memory copy of tuple length for each tuple handling. I did not see
big improvement with 'copy from' perf testing with this change ( 1%+ avg.
running time reduction of 20 runs with table lenth 1k+) but it is still
helpful.

Reviewed-by: Ashwin Agrawal
上级 852700d1
......@@ -4190,7 +4190,6 @@ CopyFrom(CopyState cstate)
HeapTuple tuple;
if (resultRelInfo->nBufferedTuples == 0)
firstBufferedLineNo = cstate->cur_lineno;
tuple = ExecFetchSlotHeapTuple(slot);
resultRelInfoList = list_append_unique_ptr(resultRelInfoList, resultRelInfo);
if (resultRelInfo->bufferedTuples == NULL)
......@@ -4202,7 +4201,8 @@ CopyFrom(CopyState cstate)
MemoryContextSwitchTo(GetPerTupleMemoryContext(estate));
/* Add this tuple to the tuple buffer */
resultRelInfo->bufferedTuples[resultRelInfo->nBufferedTuples++] = heap_copytuple(tuple);
tuple = ExecCopySlotHeapTuple(slot);
resultRelInfo->bufferedTuples[resultRelInfo->nBufferedTuples++] = tuple;
resultRelInfo->bufferedTuplesSize += tuple->t_len;
nTotalBufferedTuples++;
totalBufferedTuplesSize += tuple->t_len;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册