execnodes.h

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· C头文件 代码 · 共 1,396 行 · 第 1/4 页

H
1,396
字号
 */typedef struct SubqueryScanState{	ScanState	ss;				/* its first field is NodeTag */	PlanState  *subplan;	EState	   *sss_SubEState;} SubqueryScanState;/* ---------------- *	 FunctionScanState information * *		Function nodes are used to scan the results of a *		function appearing in FROM (typically a function returning set). * *		tupdesc				expected return tuple description *		tuplestorestate		private state of tuplestore.c *		funcexpr			state for function expression being evaluated * ---------------- */typedef struct FunctionScanState{	ScanState	ss;				/* its first field is NodeTag */	TupleDesc	tupdesc;	Tuplestorestate *tuplestorestate;	ExprState  *funcexpr;} FunctionScanState;/* ---------------- *	 ValuesScanState information * *		ValuesScan nodes are used to scan the results of a VALUES list * *		rowcontext			per-expression-list context *		exprlists			array of expression lists being evaluated *		array_len			size of array *		curr_idx			current array index (0-based) *		marked_idx			marked position (for mark/restore) * *	Note: ss.ps.ps_ExprContext is used to evaluate any qual or projection *	expressions attached to the node.  We create a second ExprContext, *	rowcontext, in which to build the executor expression state for each *	Values sublist.  Resetting this context lets us get rid of expression *	state for each row, avoiding major memory leakage over a long values list. * ---------------- */typedef struct ValuesScanState{	ScanState	ss;				/* its first field is NodeTag */	ExprContext *rowcontext;	List	  **exprlists;	int			array_len;	int			curr_idx;	int			marked_idx;} ValuesScanState;/* ---------------------------------------------------------------- *				 Join State Information * ---------------------------------------------------------------- *//* ---------------- *	 JoinState information * *		Superclass for state nodes of join plans. * ---------------- */typedef struct JoinState{	PlanState	ps;	JoinType	jointype;	List	   *joinqual;		/* JOIN quals (in addition to ps.qual) */} JoinState;/* ---------------- *	 NestLoopState information * *		NeedNewOuter	   true if need new outer tuple on next call *		MatchedOuter	   true if found a join match for current outer tuple *		NullInnerTupleSlot prepared null tuple for left outer joins * ---------------- */typedef struct NestLoopState{	JoinState	js;				/* its first field is NodeTag */	bool		nl_NeedNewOuter;	bool		nl_MatchedOuter;	TupleTableSlot *nl_NullInnerTupleSlot;} NestLoopState;/* ---------------- *	 MergeJoinState information * *		NumClauses		   number of mergejoinable join clauses *		Clauses			   info for each mergejoinable clause *		JoinState		   current "state" of join.  see execdefs.h *		FillOuter		   true if should emit unjoined outer tuples anyway *		FillInner		   true if should emit unjoined inner tuples anyway *		MatchedOuter	   true if found a join match for current outer tuple *		MatchedInner	   true if found a join match for current inner tuple *		OuterTupleSlot	   slot in tuple table for cur outer tuple *		InnerTupleSlot	   slot in tuple table for cur inner tuple *		MarkedTupleSlot    slot in tuple table for marked tuple *		NullOuterTupleSlot prepared null tuple for right outer joins *		NullInnerTupleSlot prepared null tuple for left outer joins *		OuterEContext	   workspace for computing outer tuple's join values *		InnerEContext	   workspace for computing inner tuple's join values * ---------------- *//* private in nodeMergejoin.c: */typedef struct MergeJoinClauseData *MergeJoinClause;typedef struct MergeJoinState{	JoinState	js;				/* its first field is NodeTag */	int			mj_NumClauses;	MergeJoinClause mj_Clauses; /* array of length mj_NumClauses */	int			mj_JoinState;	bool		mj_FillOuter;	bool		mj_FillInner;	bool		mj_MatchedOuter;	bool		mj_MatchedInner;	TupleTableSlot *mj_OuterTupleSlot;	TupleTableSlot *mj_InnerTupleSlot;	TupleTableSlot *mj_MarkedTupleSlot;	TupleTableSlot *mj_NullOuterTupleSlot;	TupleTableSlot *mj_NullInnerTupleSlot;	ExprContext *mj_OuterEContext;	ExprContext *mj_InnerEContext;} MergeJoinState;/* ---------------- *	 HashJoinState information * *		hj_HashTable			hash table for the hashjoin *								(NULL if table not built yet) *		hj_CurHashValue			hash value for current outer tuple *		hj_CurBucketNo			bucket# for current outer tuple *		hj_CurTuple				last inner tuple matched to current outer *								tuple, or NULL if starting search *								(CurHashValue, CurBucketNo and CurTuple are *								 undefined if OuterTupleSlot is empty!) *		hj_OuterHashKeys		the outer hash keys in the hashjoin condition *		hj_InnerHashKeys		the inner hash keys in the hashjoin condition *		hj_HashOperators		the join operators in the hashjoin condition *		hj_OuterTupleSlot		tuple slot for outer tuples *		hj_HashTupleSlot		tuple slot for hashed tuples *		hj_NullInnerTupleSlot	prepared null tuple for left outer joins *		hj_FirstOuterTupleSlot	first tuple retrieved from outer plan *		hj_NeedNewOuter			true if need new outer tuple on next call *		hj_MatchedOuter			true if found a join match for current outer *		hj_OuterNotEmpty		true if outer relation known not empty * ---------------- *//* these structs are defined in executor/hashjoin.h: */typedef struct HashJoinTupleData *HashJoinTuple;typedef struct HashJoinTableData *HashJoinTable;typedef struct HashJoinState{	JoinState	js;				/* its first field is NodeTag */	List	   *hashclauses;	/* list of ExprState nodes */	HashJoinTable hj_HashTable;	uint32		hj_CurHashValue;	int			hj_CurBucketNo;	HashJoinTuple hj_CurTuple;	List	   *hj_OuterHashKeys;		/* list of ExprState nodes */	List	   *hj_InnerHashKeys;		/* list of ExprState nodes */	List	   *hj_HashOperators;		/* list of operator OIDs */	TupleTableSlot *hj_OuterTupleSlot;	TupleTableSlot *hj_HashTupleSlot;	TupleTableSlot *hj_NullInnerTupleSlot;	TupleTableSlot *hj_FirstOuterTupleSlot;	bool		hj_NeedNewOuter;	bool		hj_MatchedOuter;	bool		hj_OuterNotEmpty;} HashJoinState;/* ---------------------------------------------------------------- *				 Materialization State Information * ---------------------------------------------------------------- *//* ---------------- *	 MaterialState information * *		materialize nodes are used to materialize the results *		of a subplan into a temporary file. * *		ss.ss_ScanTupleSlot refers to output of underlying plan. * ---------------- */typedef struct MaterialState{	ScanState	ss;				/* its first field is NodeTag */	bool		randomAccess;	/* need random access to subplan output? */	bool		eof_underlying; /* reached end of underlying plan? */	void	   *tuplestorestate;	/* private state of tuplestore.c */} MaterialState;/* ---------------- *	 SortState information * ---------------- */typedef struct SortState{	ScanState	ss;				/* its first field is NodeTag */	bool		randomAccess;	/* need random access to sort output? */	bool		sort_Done;		/* sort completed yet? */	void	   *tuplesortstate; /* private state of tuplesort.c */} SortState;/* --------------------- *	GroupState information * ------------------------- */typedef struct GroupState{	ScanState	ss;				/* its first field is NodeTag */	FmgrInfo   *eqfunctions;	/* per-field lookup data for equality fns */	bool		grp_done;		/* indicates completion of Group scan */} GroupState;/* --------------------- *	AggState information * *	ss.ss_ScanTupleSlot refers to output of underlying plan. * *	Note: ss.ps.ps_ExprContext contains ecxt_aggvalues and *	ecxt_aggnulls arrays, which hold the computed agg values for the current *	input group during evaluation of an Agg node's output tuple(s).  We *	create a second ExprContext, tmpcontext, in which to evaluate input *	expressions and run the aggregate transition functions. * ------------------------- *//* these structs are private in nodeAgg.c: */typedef struct AggStatePerAggData *AggStatePerAgg;typedef struct AggStatePerGroupData *AggStatePerGroup;typedef struct AggState{	ScanState	ss;				/* its first field is NodeTag */	List	   *aggs;			/* all Aggref nodes in targetlist & quals */	int			numaggs;		/* length of list (could be zero!) */	FmgrInfo   *eqfunctions;	/* per-grouping-field equality fns */	FmgrInfo   *hashfunctions;	/* per-grouping-field hash fns */	AggStatePerAgg peragg;		/* per-Aggref information */	MemoryContext aggcontext;	/* memory context for long-lived data */	ExprContext *tmpcontext;	/* econtext for input expressions */	bool		agg_done;		/* indicates completion of Agg scan */	/* these fields are used in AGG_PLAIN and AGG_SORTED modes: */	AggStatePerGroup pergroup;	/* per-Aggref-per-group working state */	HeapTuple	grp_firstTuple; /* copy of first tuple of current group */	/* these fields are used in AGG_HASHED mode: */	TupleHashTable hashtable;	/* hash table with one entry per group */	TupleTableSlot *hashslot;	/* slot for loading hash table */	List	   *hash_needed;	/* list of columns needed in hash table */	bool		table_filled;	/* hash table filled yet? */	TupleHashIterator hashiter; /* for iterating through hash table */} AggState;/* ---------------- *	 UniqueState information * *		Unique nodes are used "on top of" sort nodes to discard *		duplicate tuples returned from the sort phase.	Basically *		all it does is compare the current tuple from the subplan *		with the previously fetched tuple (stored in its result slot). *		If the two are identical in all interesting fields, then *		we just fetch another tuple from the sort and try again. * ---------------- */typedef struct UniqueState{	PlanState	ps;				/* its first field is NodeTag */	FmgrInfo   *eqfunctions;	/* per-field lookup data for equality fns */	MemoryContext tempContext;	/* short-term context for comparisons */} UniqueState;/* ---------------- *	 HashState information * ---------------- */typedef struct HashState{	PlanState	ps;				/* its first field is NodeTag */	HashJoinTable hashtable;	/* hash table for the hashjoin */	List	   *hashkeys;		/* list of ExprState nodes */	/* hashkeys is same as parent's hj_InnerHashKeys */} HashState;/* ---------------- *	 SetOpState information * *		SetOp nodes are used "on top of" sort nodes to discard *		duplicate tuples returned from the sort phase.	These are *		more complex than a simple Unique since we have to count *		how many duplicates to return. * ---------------- */typedef struct SetOpState{	PlanState	ps;				/* its first field is NodeTag */	FmgrInfo   *eqfunctions;	/* per-field lookup data for equality fns */	bool		subplan_done;	/* has subplan returned EOF? */	long		numLeft;		/* number of left-input dups of cur group */	long		numRight;		/* number of right-input dups of cur group */	long		numOutput;		/* number of dups left to output */	MemoryContext tempContext;	/* short-term context for comparisons */} SetOpState;/* ---------------- *	 LimitState information * *		Limit nodes are used to enforce LIMIT/OFFSET clauses. *		They just select the desired subrange of their subplan's output. * * offset is the number of initial tuples to skip (0 does nothing). * count is the number of tuples to return after skipping the offset tuples. * If no limit count was specified, count is undefined and noCount is true. * When lstate == LIMIT_INITIAL, offset/count/noCount haven't been set yet. * ---------------- */typedef enum{	LIMIT_INITIAL,				/* initial state for LIMIT node */	LIMIT_EMPTY,				/* there are no returnable rows */	LIMIT_INWINDOW,				/* have returned a row in the window */	LIMIT_SUBPLANEOF,			/* at EOF of subplan (within window) */	LIMIT_WINDOWEND,			/* stepped off end of window */	LIMIT_WINDOWSTART			/* stepped off beginning of window */} LimitStateCond;typedef struct LimitState{	PlanState	ps;				/* its first field is NodeTag */	ExprState  *limitOffset;	/* OFFSET parameter, or NULL if none */	ExprState  *limitCount;		/* COUNT parameter, or NULL if none */	int64		offset;			/* current OFFSET value */	int64		count;			/* current COUNT, if any */	bool		noCount;		/* if true, ignore count */	LimitStateCond lstate;		/* state machine status, as above */	int64		position;		/* 1-based index of last tuple returned */	TupleTableSlot *subSlot;	/* tuple last obtained from subplan */} LimitState;#endif   /* EXECNODES_H */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?