⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 relation.h

📁 PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开发团队说,该版本将加速更多企业向该数据库移植.核心开发成员之一Bruce Momjian表示,在新版PostgreSQL
💻 H
📖 第 1 页 / 共 3 页
字号:
	List	   *indexprs;		/* expressions for non-simple index columns */	List	   *indpred;		/* predicate if a partial index, else NIL */	bool		predOK;			/* true if predicate matches query */	bool		unique;			/* true if a unique index */	bool		amoptionalkey;	/* can query omit key for the first column? */} IndexOptInfo;/* * PathKeys * *	The sort ordering of a path is represented by a list of sublists of *	PathKeyItem nodes.	An empty list implies no known ordering.  Otherwise *	the first sublist represents the primary sort key, the second the *	first secondary sort key, etc.	Each sublist contains one or more *	PathKeyItem nodes, each of which can be taken as the attribute that *	appears at that sort position.	(See optimizer/README for more *	information.) */typedef struct PathKeyItem{	NodeTag		type;	Node	   *key;			/* the item that is ordered */	Oid			sortop;			/* the ordering operator ('<' op) */	/*	 * key typically points to a Var node, ie a relation attribute, but it can	 * also point to an arbitrary expression representing the value indexed by	 * an index expression.	 */} PathKeyItem;/* * Type "Path" is used as-is for sequential-scan paths.  For other * path types it is the first component of a larger struct. * * Note: "pathtype" is the NodeTag of the Plan node we could build from this * Path.  It is partially redundant with the Path's NodeTag, but allows us * to use the same Path type for multiple Plan types where there is no need * to distinguish the Plan type during path processing. */typedef struct Path{	NodeTag		type;	NodeTag		pathtype;		/* tag identifying scan/join method */	RelOptInfo *parent;			/* the relation this path can build */	/* estimated execution costs for path (see costsize.c for more info) */	Cost		startup_cost;	/* cost expended before fetching any tuples */	Cost		total_cost;		/* total cost (assuming all tuples fetched) */	List	   *pathkeys;		/* sort ordering of path's output */	/* pathkeys is a List of Lists of PathKeyItem nodes; see above */} Path;/*---------- * IndexPath represents an index scan over a single index. * * 'indexinfo' is the index to be scanned. * * 'indexclauses' is a list of index qualification clauses, with implicit * AND semantics across the list.  Each clause is a RestrictInfo node from * the query's WHERE or JOIN conditions. * * 'indexquals' has the same structure as 'indexclauses', but it contains * the actual indexqual conditions that can be used with the index. * In simple cases this is identical to 'indexclauses', but when special * indexable operators appear in 'indexclauses', they are replaced by the * derived indexscannable conditions in 'indexquals'. * * 'isjoininner' is TRUE if the path is a nestloop inner scan (that is, * some of the index conditions are join rather than restriction clauses). * Note that the path costs will be calculated differently from a plain * indexscan in this case, and in addition there's a special 'rows' value * different from the parent RelOptInfo's (see below). * * 'indexscandir' is one of: *		ForwardScanDirection: forward scan of an ordered index *		BackwardScanDirection: backward scan of an ordered index *		NoMovementScanDirection: scan of an unordered index, or don't care * (The executor doesn't care whether it gets ForwardScanDirection or * NoMovementScanDirection for an indexscan, but the planner wants to * distinguish ordered from unordered indexes for building pathkeys.) * * 'indextotalcost' and 'indexselectivity' are saved in the IndexPath so that * we need not recompute them when considering using the same index in a * bitmap index/heap scan (see BitmapHeapPath).  The costs of the IndexPath * itself represent the costs of an IndexScan plan type. * * 'rows' is the estimated result tuple count for the indexscan.  This * is the same as path.parent->rows for a simple indexscan, but it is * different for a nestloop inner scan, because the additional indexquals * coming from join clauses make the scan more selective than the parent * rel's restrict clauses alone would do. *---------- */typedef struct IndexPath{	Path		path;	IndexOptInfo *indexinfo;	List	   *indexclauses;	List	   *indexquals;	bool		isjoininner;	ScanDirection indexscandir;	Cost		indextotalcost;	Selectivity indexselectivity;	double		rows;			/* estimated number of result tuples */} IndexPath;/* * BitmapHeapPath represents one or more indexscans that generate TID bitmaps * instead of directly accessing the heap, followed by AND/OR combinations * to produce a single bitmap, followed by a heap scan that uses the bitmap. * Note that the output is always considered unordered, since it will come * out in physical heap order no matter what the underlying indexes did. * * The individual indexscans are represented by IndexPath nodes, and any * logic on top of them is represented by a tree of BitmapAndPath and * BitmapOrPath nodes.	Notice that we can use the same IndexPath node both * to represent a regular IndexScan plan, and as the child of a BitmapHeapPath * that represents scanning the same index using a BitmapIndexScan.  The * startup_cost and total_cost figures of an IndexPath always represent the * costs to use it as a regular IndexScan.	The costs of a BitmapIndexScan * can be computed using the IndexPath's indextotalcost and indexselectivity. * * BitmapHeapPaths can be nestloop inner indexscans.  The isjoininner and * rows fields serve the same purpose as for plain IndexPaths. */typedef struct BitmapHeapPath{	Path		path;	Path	   *bitmapqual;		/* IndexPath, BitmapAndPath, BitmapOrPath */	bool		isjoininner;	/* T if it's a nestloop inner scan */	double		rows;			/* estimated number of result tuples */} BitmapHeapPath;/* * BitmapAndPath represents a BitmapAnd plan node; it can only appear as * part of the substructure of a BitmapHeapPath.  The Path structure is * a bit more heavyweight than we really need for this, but for simplicity * we make it a derivative of Path anyway. */typedef struct BitmapAndPath{	Path		path;	List	   *bitmapquals;	/* IndexPaths and BitmapOrPaths */	Selectivity bitmapselectivity;} BitmapAndPath;/* * BitmapOrPath represents a BitmapOr plan node; it can only appear as * part of the substructure of a BitmapHeapPath.  The Path structure is * a bit more heavyweight than we really need for this, but for simplicity * we make it a derivative of Path anyway. */typedef struct BitmapOrPath{	Path		path;	List	   *bitmapquals;	/* IndexPaths and BitmapAndPaths */	Selectivity bitmapselectivity;} BitmapOrPath;/* * TidPath represents a scan by TID * * tidquals is an implicitly OR'ed list of qual expressions of the form * "CTID = pseudoconstant" or "CTID = ANY(pseudoconstant_array)". * Note they are bare expressions, not RestrictInfos. */typedef struct TidPath{	Path		path;	List	   *tidquals;		/* qual(s) involving CTID = something */} TidPath;/* * AppendPath represents an Append plan, ie, successive execution of * several member plans. * * Note: it is possible for "subpaths" to contain only one, or even no, * elements.  These cases are optimized during create_append_plan. */typedef struct AppendPath{	Path		path;	List	   *subpaths;		/* list of component Paths */} AppendPath;/* * ResultPath represents use of a Result plan node to compute a variable-free * targetlist with no underlying tables (a "SELECT expressions" query). * The query could have a WHERE clause, too, represented by "quals". * * Note that quals is a list of bare clauses, not RestrictInfos. */typedef struct ResultPath{	Path		path;	List	   *quals;} ResultPath;/* * MaterialPath represents use of a Material plan node, i.e., caching of * the output of its subpath.  This is used when the subpath is expensive * and needs to be scanned repeatedly, or when we need mark/restore ability * and the subpath doesn't have it. */typedef struct MaterialPath{	Path		path;	Path	   *subpath;} MaterialPath;/* * UniquePath represents elimination of distinct rows from the output of * its subpath. * * This is unlike the other Path nodes in that it can actually generate * different plans: either hash-based or sort-based implementation, or a * no-op if the input path can be proven distinct already.	The decision * is sufficiently localized that it's not worth having separate Path node * types.  (Note: in the no-op case, we could eliminate the UniquePath node * entirely and just return the subpath; but it's convenient to have a * UniquePath in the path tree to signal upper-level routines that the input * is known distinct.) */typedef enum{	UNIQUE_PATH_NOOP,			/* input is known unique already */	UNIQUE_PATH_HASH,			/* use hashing */	UNIQUE_PATH_SORT			/* use sorting */} UniquePathMethod;typedef struct UniquePath{	Path		path;	Path	   *subpath;	UniquePathMethod umethod;	double		rows;			/* estimated number of result tuples */} UniquePath;/* * All join-type paths share these fields. */typedef struct JoinPath{	Path		path;	JoinType	jointype;	Path	   *outerjoinpath;	/* path for the outer side of the join */	Path	   *innerjoinpath;	/* path for the inner side of the join */	List	   *joinrestrictinfo;		/* RestrictInfos to apply to join */	/*	 * See the notes for RelOptInfo to understand why joinrestrictinfo is	 * needed in JoinPath, and can't be merged into the parent RelOptInfo.	 */} JoinPath;/* * A nested-loop path needs no special fields. */typedef JoinPath NestPath;/* * A mergejoin path has these fields. * * path_mergeclauses lists the clauses (in the form of RestrictInfos) * that will be used in the merge. * * Note that the mergeclauses are a subset of the parent relation's * restriction-clause list.  Any join clauses that are not mergejoinable * appear only in the parent's restrict list, and must be checked by a * qpqual at execution time. * * outersortkeys (resp. innersortkeys) is NIL if the outer path * (resp. inner path) is already ordered appropriately for the * mergejoin.  If it is not NIL then it is a PathKeys list describing * the ordering that must be created by an explicit sort step. */typedef struct MergePath{	JoinPath	jpath;	List	   *path_mergeclauses;		/* join clauses to be used for merge */	List	   *outersortkeys;	/* keys for explicit sort, if any */	List	   *innersortkeys;	/* keys for explicit sort, if any */} MergePath;/* * A hashjoin path has these fields. * * The remarks above for mergeclauses apply for hashclauses as well. * * Hashjoin does not care what order its inputs appear in, so we have * no need for sortkeys. */typedef struct HashPath{	JoinPath	jpath;	List	   *path_hashclauses;		/* join clauses used for hashing */} HashPath;/* * Restriction clause info. * * We create one of these for each AND sub-clause of a restriction condition * (WHERE or JOIN/ON clause).  Since the restriction clauses are logically * ANDed, we can use any one of them or any subset of them to filter out * tuples, without having to evaluate the rest.  The RestrictInfo node itself * stores data used by the optimizer while choosing the best query plan. * * If a restriction clause references a single base relation, it will appear * in the baserestrictinfo list of the RelOptInfo for that base rel. * * If a restriction clause references more than one base rel, it will * appear in the joininfo list of every RelOptInfo that describes a strict * subset of the base rels mentioned in the clause.  The joininfo lists are * used to drive join tree building by selecting plausible join candidates. * The clause cannot actually be applied until we have built a join rel * containing all the base rels it references, however. *

⌨️ 快捷键说明

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