aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-01-27 00:36:28 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-01-27 00:36:28 +0000
commit422221c90de5d65213e8e697ac0da77098ba22a9 (patch)
tree2248f8bc5a5afcf67abb052be918a32d17360dad /src/backend/executor
parent36693c05257c7a34be8f1dd1e6b4a7ce45980fa5 (diff)
downloadpostgresql-422221c90de5d65213e8e697ac0da77098ba22a9.tar.gz
postgresql-422221c90de5d65213e8e697ac0da77098ba22a9.zip
Another SELECT speedup: extract OIDs of column print functions
only once per SELECT, not once per tuple. 10% here, 10% there, pretty soon you're talking about real speedups ...
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execMain.c40
-rw-r--r--src/backend/executor/spi.c6
2 files changed, 28 insertions, 18 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index e79816389cc..79cffc49f8f 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.63 1999/01/25 12:01:03 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.64 1999/01/27 00:36:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,9 +66,10 @@ static void EndPlan(Plan *plan, EState *estate);
static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
Query *parseTree, CmdType operation,
int numberTuples, ScanDirection direction,
- void (*printfunc) ());
-static void ExecRetrieve(TupleTableSlot *slot, void (*printfunc) (),
- EState *estate);
+ DestReceiver *destfunc);
+static void ExecRetrieve(TupleTableSlot *slot,
+ DestReceiver *destfunc,
+ EState *estate);
static void ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate);
static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
@@ -171,7 +172,7 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
Plan *plan;
TupleTableSlot *result;
CommandDest dest;
- void (*destination) ();
+ DestReceiver *destfunc;
/******************
* sanity checks
@@ -188,10 +189,19 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
parseTree = queryDesc->parsetree;
plan = queryDesc->plantree;
dest = queryDesc->dest;
- destination = (void (*) ()) DestToFunction(dest);
+ destfunc = DestToFunction(dest);
estate->es_processed = 0;
estate->es_lastoid = InvalidOid;
+ /******************
+ * FIXME: the dest setup function ought to be handed the tuple desc
+ * for the tuples to be output, but I'm not quite sure how to get that
+ * info at this point. For now, passing NULL is OK because no existing
+ * dest setup function actually uses the pointer.
+ ******************
+ */
+ (*destfunc->setup) (destfunc, (TupleDesc) NULL);
+
switch (feature)
{
@@ -202,7 +212,7 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
operation,
ALL_TUPLES,
ForwardScanDirection,
- destination);
+ destfunc);
break;
case EXEC_FOR:
result = ExecutePlan(estate,
@@ -211,7 +221,7 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
operation,
count,
ForwardScanDirection,
- destination);
+ destfunc);
break;
/******************
@@ -225,7 +235,7 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
operation,
count,
BackwardScanDirection,
- destination);
+ destfunc);
break;
/******************
@@ -240,7 +250,7 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
operation,
ONE_TUPLE,
ForwardScanDirection,
- destination);
+ destfunc);
break;
default:
result = NULL;
@@ -248,6 +258,8 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
break;
}
+ (*destfunc->cleanup) (destfunc);
+
return result;
}
@@ -745,7 +757,7 @@ ExecutePlan(EState *estate,
CmdType operation,
int numberTuples,
ScanDirection direction,
- void (*printfunc) ())
+ DestReceiver* destfunc)
{
JunkFilter *junkfilter;
@@ -905,7 +917,7 @@ ExecutePlan(EState *estate,
{
case CMD_SELECT:
ExecRetrieve(slot, /* slot containing tuple */
- printfunc, /* print function */
+ destfunc, /* destination's tuple-receiver obj */
estate); /* */
result = slot;
break;
@@ -961,7 +973,7 @@ ExecutePlan(EState *estate,
*/
static void
ExecRetrieve(TupleTableSlot *slot,
- void (*printfunc) (),
+ DestReceiver *destfunc,
EState *estate)
{
HeapTuple tuple;
@@ -988,7 +1000,7 @@ ExecRetrieve(TupleTableSlot *slot,
* send the tuple to the front end (or the screen)
******************
*/
- (*printfunc) (tuple, attrtype);
+ (*destfunc->receiveTuple) (tuple, attrtype, destfunc);
IncrRetrieved();
(estate->es_processed)++;
}
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 5620cf78916..a7358425b47 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -3,7 +3,7 @@
* spi.c--
* Server Programming Interface
*
- * $Id: spi.c,v 1.30 1999/01/24 05:40:48 tgl Exp $
+ * $Id: spi.c,v 1.31 1999/01/27 00:36:21 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,8 +32,6 @@ uint32 SPI_processed = 0;
SPITupleTable *SPI_tuptable;
int SPI_result;
-void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
-
typedef struct
{
QueryTreeList *qtlist;
@@ -566,7 +564,7 @@ SPI_pfree(void *pointer)
*
*/
void
-spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
+spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver* self)
{
SPITupleTable *tuptable;
MemoryContext oldcxt;