diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-16 21:38:10 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-16 21:38:10 +0000 |
commit | f97aebd162987d00bd9b9f592ff54e9e90f11843 (patch) | |
tree | 78c6ff493070f92e7fda262a2c25e2545f0d2b21 /src/backend/executor/nodeSeqscan.c | |
parent | 712f053587b552769d1d3f6fe0ec03ab79c05d26 (diff) | |
download | postgresql-f97aebd162987d00bd9b9f592ff54e9e90f11843.tar.gz postgresql-f97aebd162987d00bd9b9f592ff54e9e90f11843.zip |
Revise TupleTableSlot code to avoid unnecessary construction and disassembly
of tuples when passing data up through multiple plan nodes. A slot can now
hold either a normal "physical" HeapTuple, or a "virtual" tuple consisting
of Datum/isnull arrays. Upper plan levels can usually just copy the Datum
arrays, avoiding heap_formtuple() and possible subsequent nocachegetattr()
calls to extract the data again. This work extends Atsushi Ogawa's earlier
patch, which provided the key idea of adding Datum arrays to TupleTableSlots.
(I believe however that something like this was foreseen way back in Berkeley
days --- see the old comment on ExecProject.) A test case involving many
levels of join of fairly wide tables (about 80 columns altogether) showed
about 3x overall speedup, though simple queries will probably not be
helped very much.
I have also duplicated some code in heaptuple.c in order to provide versions
of heap_formtuple and friends that use "bool" arrays to indicate null
attributes, instead of the old convention of "char" arrays containing either
'n' or ' '. This provides a better match to the convention used by
ExecEvalExpr. While I have not made a concerted effort to get rid of uses
of the old routines, I think they should be deprecated and eventually removed.
Diffstat (limited to 'src/backend/executor/nodeSeqscan.c')
-rw-r--r-- | src/backend/executor/nodeSeqscan.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c index 621911652a9..f5a284a26bf 100644 --- a/src/backend/executor/nodeSeqscan.c +++ b/src/backend/executor/nodeSeqscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.51 2004/12/31 21:59:45 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.52 2005/03/16 21:38:07 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -110,12 +110,12 @@ SeqNext(SeqScanState *node) * refcount of the buffer; the refcount will not be dropped until the * tuple table slot is cleared. */ - - slot = ExecStoreTuple(tuple, /* tuple to store */ - slot, /* slot to store in */ - scandesc->rs_cbuf, /* buffer associated with + if (tuple) + ExecStoreTuple(tuple, /* tuple to store */ + slot, /* slot to store in */ + scandesc->rs_cbuf, /* buffer associated with * this tuple */ - false); /* don't pfree this pointer */ + false); /* don't pfree this pointer */ return slot; } |