diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-16 20:07:35 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-04-16 20:07:35 +0000 |
commit | d8b1bf47918aafdc515729624ad1ec2db4b91d14 (patch) | |
tree | 666046eec1e911ef6593a5fe6db6b3e938607a73 /src/backend/executor/execProcnode.c | |
parent | 85eee28ceca0814384392020c6c9a8269f213510 (diff) | |
download | postgresql-d8b1bf47918aafdc515729624ad1ec2db4b91d14.tar.gz postgresql-d8b1bf47918aafdc515729624ad1ec2db4b91d14.zip |
Create a new 'MultiExecProcNode' call API for plan nodes that don't
return just a single tuple at a time. Currently the only such node
type is Hash, but I expect we will soon have indexscans that can return
tuple bitmaps. A side benefit is that EXPLAIN ANALYZE now shows the
correct tuple count for a Hash node.
Diffstat (limited to 'src/backend/executor/execProcnode.c')
-rw-r--r-- | src/backend/executor/execProcnode.c | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c index ff8caf16f01..555668e7799 100644 --- a/src/backend/executor/execProcnode.c +++ b/src/backend/executor/execProcnode.c @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.48 2005/04/06 20:13:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.49 2005/04/16 20:07:35 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -375,6 +375,50 @@ ExecProcNode(PlanState *node) return result; } + +/* ---------------------------------------------------------------- + * MultiExecProcNode + * + * Execute a node that doesn't return individual tuples + * (it might return a hashtable, bitmap, etc). Caller should + * check it got back the expected kind of Node. + * + * This has essentially the same responsibilities as ExecProcNode, + * but it does not do InstrStartNode/InstrStopNode (mainly because + * it can't tell how many returned tuples to count). Each per-node + * function must provide its own instrumentation support. + * ---------------------------------------------------------------- + */ +Node * +MultiExecProcNode(PlanState *node) +{ + Node *result; + + CHECK_FOR_INTERRUPTS(); + + if (node->chgParam != NULL) /* something changed */ + ExecReScan(node, NULL); /* let ReScan handle this */ + + switch (nodeTag(node)) + { + /* + * Only node types that actually support multiexec will be listed + */ + + case T_HashState: + result = MultiExecHash((HashState *) node); + break; + + default: + elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node)); + result = NULL; + break; + } + + return result; +} + + /* * ExecCountSlotsNode - count up the number of tuple table slots needed * |