aboutsummaryrefslogtreecommitdiff
path: root/src/include/executor
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-07-12 02:37:39 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-07-12 02:37:39 +0000
commitbadce86a2c327b40c6146242526d1523455d64a6 (patch)
tree6e0cb658889a2688e76d9ac19a56555c5eb0e738 /src/include/executor
parent46fb9c29e2990ba470bb741ff6dd60f2ae218e64 (diff)
downloadpostgresql-badce86a2c327b40c6146242526d1523455d64a6.tar.gz
postgresql-badce86a2c327b40c6146242526d1523455d64a6.zip
First stage of reclaiming memory in executor by resetting short-term
memory contexts. Currently, only leaks in expressions executed as quals or projections are handled. Clean up some old dead cruft in executor while at it --- unused fields in state nodes, that sort of thing.
Diffstat (limited to 'src/include/executor')
-rw-r--r--src/include/executor/executor.h31
-rw-r--r--src/include/executor/hashjoin.h14
-rw-r--r--src/include/executor/nodeGroup.h5
-rw-r--r--src/include/executor/nodeHash.h12
-rw-r--r--src/include/executor/nodeSubplan.h2
5 files changed, 39 insertions, 25 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 703c907e127..b835b290440 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: executor.h,v 1.45 2000/06/18 22:44:28 tgl Exp $
+ * $Id: executor.h,v 1.46 2000/07/12 02:37:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -72,19 +72,16 @@ extern void ExecEndNode(Plan *node, Plan *parent);
/*
* prototypes from functions in execQual.c
*/
-extern bool execConstByVal;
-extern int execConstLen;
-
-extern Datum ExecExtractResult(TupleTableSlot *slot, AttrNumber attnum,
- bool *isNull);
extern Datum ExecEvalParam(Param *expression, ExprContext *econtext,
bool *isNull);
-
extern char *GetAttributeByNum(TupleTableSlot *slot, AttrNumber attrno,
bool *isNull);
-extern char *GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull);
-extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext, bool *isNull,
- bool *isDone);
+extern char *GetAttributeByName(TupleTableSlot *slot, char *attname,
+ bool *isNull);
+extern Datum ExecEvalExpr(Node *expression, ExprContext *econtext,
+ bool *isNull, bool *isDone);
+extern Datum ExecEvalExprSwitchContext(Node *expression, ExprContext *econtext,
+ bool *isNull, bool *isDone);
extern bool ExecQual(List *qual, ExprContext *econtext, bool resultForNull);
extern int ExecTargetListLength(List *targetlist);
extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo, bool *isDone);
@@ -92,7 +89,9 @@ extern TupleTableSlot *ExecProject(ProjectionInfo *projInfo, bool *isDone);
/*
* prototypes from functions in execScan.c
*/
-extern TupleTableSlot *ExecScan(Scan *node, TupleTableSlot *(*accessMtd) ());
+typedef TupleTableSlot *(*ExecScanAccessMtd) (Scan *node);
+
+extern TupleTableSlot *ExecScan(Scan *node, ExecScanAccessMtd accessMtd);
/*
* prototypes from functions in execTuples.c
@@ -121,8 +120,6 @@ extern void SetChangedParamList(Plan *node, List *newchg);
* prototypes from functions in execUtils.c
*/
extern void ResetTupleCount(void);
-extern void ExecAssignNodeBaseInfo(EState *estate, CommonState *basenode,
- Plan *parent);
extern void ExecAssignExprContext(EState *estate, CommonState *commonstate);
extern void ExecAssignResultType(CommonState *commonstate,
TupleDesc tupDesc);
@@ -133,7 +130,6 @@ extern TupleDesc ExecGetResultType(CommonState *commonstate);
extern void ExecAssignProjectionInfo(Plan *node, CommonState *commonstate);
extern void ExecFreeProjectionInfo(CommonState *commonstate);
extern void ExecFreeExprContext(CommonState *commonstate);
-extern void ExecFreeTypeInfo(CommonState *commonstate);
extern TupleDesc ExecGetScanType(CommonScanState *csstate);
extern void ExecAssignScanType(CommonScanState *csstate,
TupleDesc tupDesc);
@@ -141,6 +137,13 @@ extern void ExecAssignScanTypeFromOuterPlan(Plan *node,
CommonScanState *csstate);
extern Form_pg_attribute ExecGetTypeInfo(Relation relDesc);
+extern ExprContext *MakeExprContext(TupleTableSlot *slot,
+ MemoryContext queryContext);
+extern void FreeExprContext(ExprContext *econtext);
+
+#define ResetExprContext(econtext) \
+ MemoryContextReset((econtext)->ecxt_per_tuple_memory)
+
extern void ExecOpenIndices(RelationInfo *resultRelationInfo);
extern void ExecCloseIndices(RelationInfo *resultRelationInfo);
extern void ExecInsertIndexTuples(TupleTableSlot *slot, ItemPointer tupleid,
diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h
index 285bb314d3d..8d4cb98469f 100644
--- a/src/include/executor/hashjoin.h
+++ b/src/include/executor/hashjoin.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: hashjoin.h,v 1.17 2000/06/28 03:33:05 tgl Exp $
+ * $Id: hashjoin.h,v 1.18 2000/07/12 02:37:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,8 +21,8 @@
* hash-join hash table structures
*
* Each active hashjoin has a HashJoinTable control block which is
- * palloc'd in the executor's context. All other storage needed for
- * the hashjoin is kept in private memory contexts, two for each hashjoin.
+ * palloc'd in the executor's per-query context. All other storage needed
+ * for the hashjoin is kept in private memory contexts, two for each hashjoin.
* This makes it easy and fast to release the storage when we don't need it
* anymore.
*
@@ -69,6 +69,14 @@ typedef struct HashTableData
* file */
/*
+ * Info about the datatype being hashed. We assume that the inner
+ * and outer sides of the hash are the same type, or at least
+ * binary-compatible types.
+ */
+ bool typByVal;
+ int typLen;
+
+ /*
* During 1st scan of inner relation, we get tuples from executor. If
* nbatch > 0 then tuples that don't belong in first nbuckets logical
* buckets get dumped into inner-batch temp files. The same statements
diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h
index 303516b167e..71bd3b52ff5 100644
--- a/src/include/executor/nodeGroup.h
+++ b/src/include/executor/nodeGroup.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeGroup.h,v 1.16 2000/04/12 17:16:33 momjian Exp $
+ * $Id: nodeGroup.h,v 1.17 2000/07/12 02:37:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,7 +27,8 @@ extern bool execTuplesMatch(HeapTuple tuple1,
TupleDesc tupdesc,
int numCols,
AttrNumber *matchColIdx,
- FmgrInfo *eqfunctions);
+ FmgrInfo *eqfunctions,
+ MemoryContext evalContext);
extern FmgrInfo *execTuplesMatchPrepare(TupleDesc tupdesc,
int numCols,
AttrNumber *matchColIdx);
diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h
index b61ced7cdc1..5fabe7d253a 100644
--- a/src/include/executor/nodeHash.h
+++ b/src/include/executor/nodeHash.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: nodeHash.h,v 1.16 2000/04/18 05:43:00 tgl Exp $
+ * $Id: nodeHash.h,v 1.17 2000/07/12 02:37:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -25,10 +25,12 @@ extern int ExecCountSlotsHash(Hash *node);
extern void ExecEndHash(Hash *node);
extern HashJoinTable ExecHashTableCreate(Hash *node);
extern void ExecHashTableDestroy(HashJoinTable hashtable);
-extern void ExecHashTableInsert(HashJoinTable hashtable, ExprContext *econtext,
- Var *hashkey);
-extern int ExecHashGetBucket(HashJoinTable hashtable, ExprContext *econtext,
- Var *hashkey);
+extern void ExecHashTableInsert(HashJoinTable hashtable,
+ ExprContext *econtext,
+ Node *hashkey);
+extern int ExecHashGetBucket(HashJoinTable hashtable,
+ ExprContext *econtext,
+ Node *hashkey);
extern HeapTuple ExecScanHashBucket(HashJoinState *hjstate, List *hjclauses,
ExprContext *econtext);
extern void ExecHashTableReset(HashJoinTable hashtable, long ntuples);
diff --git a/src/include/executor/nodeSubplan.h b/src/include/executor/nodeSubplan.h
index a56ae216f5e..f7c46c3ca92 100644
--- a/src/include/executor/nodeSubplan.h
+++ b/src/include/executor/nodeSubplan.h
@@ -13,7 +13,7 @@ extern Datum ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext,
bool *isNull);
extern bool ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent);
extern void ExecReScanSetParamPlan(SubPlan *node, Plan *parent);
-extern void ExecSetParamPlan(SubPlan *node);
+extern void ExecSetParamPlan(SubPlan *node, ExprContext *econtext);
extern void ExecEndSubPlan(SubPlan *node);
#endif /* NODESUBPLAN_H */