Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitadfa042

Browse files
committed
Save a few cycles in EXPLAIN and related commands by not bothering to form
a physical tuple in do_tup_output(). A virtual tuple is easier to set upand also easier for most tuple receivers to process. Per my comment onRobert Haas' recent patch in this code.
1 parent6a0865e commitadfa042

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

‎src/backend/executor/execTuples.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.108 2009/07/22 17:00:20 tgl Exp $
18+
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.109 2009/07/23 21:27:10 tgl Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -1215,27 +1215,28 @@ begin_tup_output_tupdesc(DestReceiver *dest, TupleDesc tupdesc)
12151215

12161216
/*
12171217
* write a single tuple
1218-
*
1219-
* XXX This could be made more efficient, since in reality we probably only
1220-
* need a virtual tuple.
12211218
*/
12221219
void
12231220
do_tup_output(TupOutputState*tstate,Datum*values,bool*isnull)
12241221
{
1225-
TupleDesctupdesc=tstate->slot->tts_tupleDescriptor;
1226-
HeapTupletuple;
1222+
TupleTableSlot*slot=tstate->slot;
1223+
intnatts=slot->tts_tupleDescriptor->natts;
12271224

1228-
/*form a tuple */
1229-
tuple=heap_form_tuple(tupdesc,values,isnull);
1225+
/*make sure the slot is clear */
1226+
ExecClearTuple(slot);
12301227

1231-
/* put it in a slot */
1232-
ExecStoreTuple(tuple,tstate->slot,InvalidBuffer, true);
1228+
/* insert data */
1229+
memcpy(slot->tts_values,values,natts*sizeof(Datum));
1230+
memcpy(slot->tts_isnull,isnull,natts*sizeof(bool));
1231+
1232+
/* mark slot as containing a virtual tuple */
1233+
ExecStoreVirtualTuple(slot);
12331234

12341235
/* send the tuple to the receiver */
1235-
(*tstate->dest->receiveSlot) (tstate->slot,tstate->dest);
1236+
(*tstate->dest->receiveSlot) (slot,tstate->dest);
12361237

12371238
/* clean up */
1238-
ExecClearTuple(tstate->slot);
1239+
ExecClearTuple(slot);
12391240
}
12401241

12411242
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp