diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 01:11:26 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-27 01:11:26 +0000 |
commit | c7ff7663e47fc4e295700101912f2b7dd53c1f4b (patch) | |
tree | 13e987e4894faca0086b78568b08b79cf124e8a1 /src/backend/executor/execUtils.c | |
parent | 4756ff3dca903dfc525d1c27fd00fad8ca328188 (diff) | |
download | postgresql-c7ff7663e47fc4e295700101912f2b7dd53c1f4b.tar.gz postgresql-c7ff7663e47fc4e295700101912f2b7dd53c1f4b.zip |
Get rid of the separate EState for subplans, and just let them share the
parent query's EState. Now that there's a single flat rangetable for both
the main plan and subplans, there's no need anymore for a separate EState,
and removing it allows cleaning up some crufty code in nodeSubplan.c and
nodeSubqueryscan.c. Should be a tad faster too, although any difference
will probably be hard to measure. This is the last bit of subsidiary
mop-up work from changing to a flat rangetable.
Diffstat (limited to 'src/backend/executor/execUtils.c')
-rw-r--r-- | src/backend/executor/execUtils.c | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index d188a38489d..493df3ef9ac 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -8,14 +8,13 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.146 2007/02/22 22:00:22 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.147 2007/02/27 01:11:25 tgl Exp $ * *------------------------------------------------------------------------- */ /* * INTERFACE ROUTINES * CreateExecutorState Create/delete executor working state - * CreateSubExecutorState * FreeExecutorState * CreateExprContext * CreateStandaloneExprContext @@ -66,8 +65,6 @@ int NIndexTupleInserted; int NIndexTupleProcessed; -static EState *InternalCreateExecutorState(MemoryContext qcontext, - bool is_subquery); static void ShutdownExprContext(ExprContext *econtext); @@ -152,7 +149,9 @@ DisplayTupleCount(FILE *statfp) EState * CreateExecutorState(void) { + EState *estate; MemoryContext qcontext; + MemoryContext oldcontext; /* * Create the per-query context for this Executor run. @@ -163,37 +162,6 @@ CreateExecutorState(void) ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE); - return InternalCreateExecutorState(qcontext, false); -} - -/* ---------------- - * CreateSubExecutorState - * - * Create and initialize an EState node for a sub-query. - * - * Ideally, sub-queries probably shouldn't have their own EState at all, - * but right now this is necessary because they have their own rangetables - * and we access the rangetable via the EState. It is critical that a - * sub-query share the parent's es_query_cxt, else structures allocated by - * the sub-query (especially its result tuple descriptor) may disappear - * too soon during executor shutdown. - * ---------------- - */ -EState * -CreateSubExecutorState(EState *parent_estate) -{ - return InternalCreateExecutorState(parent_estate->es_query_cxt, true); -} - -/* - * Guts of CreateExecutorState/CreateSubExecutorState - */ -static EState * -InternalCreateExecutorState(MemoryContext qcontext, bool is_subquery) -{ - EState *estate; - MemoryContext oldcontext; - /* * Make the EState node within the per-query context. This way, we don't * need a separate pfree() operation for it at shutdown. @@ -232,14 +200,14 @@ InternalCreateExecutorState(MemoryContext qcontext, bool is_subquery) estate->es_lastoid = InvalidOid; estate->es_rowMarks = NIL; - estate->es_is_subquery = is_subquery; - estate->es_instrument = false; estate->es_select_into = false; estate->es_into_oids = false; estate->es_exprcontexts = NIL; + estate->es_subplanstates = NIL; + estate->es_per_tuple_exprcontext = NULL; estate->es_plannedstmt = NULL; @@ -292,12 +260,9 @@ FreeExecutorState(EState *estate) /* * Free the per-query memory context, thereby releasing all working - * memory, including the EState node itself. In a subquery, we don't - * do this, leaving the memory cleanup to happen when the topmost query - * is closed down. + * memory, including the EState node itself. */ - if (!estate->es_is_subquery) - MemoryContextDelete(estate->es_query_cxt); + MemoryContextDelete(estate->es_query_cxt); } /* ---------------- |