aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/relation.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r--src/include/nodes/relation.h89
1 files changed, 51 insertions, 38 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index f01877a9e89..b7d65131066 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relation.h,v 1.46 2000/03/22 22:08:29 tgl Exp $
+ * $Id: relation.h,v 1.47 2000/04/12 17:16:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,7 +30,10 @@ typedef List *Relids;
* When looking for a "cheapest path", this enum specifies whether we want
* cheapest startup cost or cheapest total cost.
*/
-typedef enum CostSelector { STARTUP_COST, TOTAL_COST } CostSelector;
+typedef enum CostSelector
+{
+ STARTUP_COST, TOTAL_COST
+} CostSelector;
/*
* RelOptInfo
@@ -82,7 +85,7 @@ typedef enum CostSelector { STARTUP_COST, TOTAL_COST } CostSelector;
* (For example, in a 3-base-rel join, a clause relating rels 1 and 2 must be
* treated as a restrictclause if we join {1} and {2 3} to make {1 2 3}; but
* if we join {1 2} and {3} then that clause will be a restrictclause in {1 2}
- * and should not be processed again at the level of {1 2 3}.) Therefore,
+ * and should not be processed again at the level of {1 2 3}.) Therefore,
* the restrictinfo list in the join case appears in individual JoinPaths
* (field joinrestrictinfo), not in the parent relation. But it's OK for
* the RelOptInfo to store the joininfo lists, because those are the same
@@ -98,7 +101,8 @@ typedef struct RelOptInfo
NodeTag type;
/* all relations included in this RelOptInfo */
- Relids relids; /* integer list of base relids (RT indexes) */
+ Relids relids; /* integer list of base relids (RT
+ * indexes) */
/* size estimates generated by planner */
double rows; /* estimated number of result tuples */
@@ -117,11 +121,14 @@ typedef struct RelOptInfo
double tuples;
/* used by various scans and joins: */
- List *baserestrictinfo; /* RestrictInfo structures (if base rel) */
- Cost baserestrictcost; /* cost of evaluating the above */
+ List *baserestrictinfo; /* RestrictInfo structures (if
+ * base rel) */
+ Cost baserestrictcost; /* cost of evaluating the above */
List *joininfo; /* JoinInfo structures */
List *innerjoin; /* potential indexscans for nestloop joins */
- /* innerjoin indexscans are not in the main pathlist because they are
+
+ /*
+ * innerjoin indexscans are not in the main pathlist because they are
* not usable except in specific join contexts; we have to test before
* seeing whether they can be used.
*/
@@ -143,8 +150,8 @@ typedef struct RelOptInfo
* ordering - List of PG_OPERATOR OIDs which order the indexscan result
* relam - the OID of the pg_am of the index
* amcostestimate - OID of the relam's cost estimator
- * indproc - OID of the function if a functional index, else 0
- * indpred - index predicate if a partial index, else NULL
+ * indproc - OID of the function if a functional index, else 0
+ * indpred - index predicate if a partial index, else NULL
* lossy - true if index is lossy (may return non-matching tuples)
*
* NB. the last element of the arrays classlist, indexkeys and ordering
@@ -167,7 +174,7 @@ typedef struct IndexOptInfo
Oid *ordering; /* OIDs of sort operators for each key */
Oid relam; /* OID of the access method (in pg_am) */
- RegProcedure amcostestimate; /* OID of the access method's cost fcn */
+ RegProcedure amcostestimate;/* OID of the access method's cost fcn */
Oid indproc; /* if a functional index */
List *indpred; /* if a partial index */
@@ -178,11 +185,11 @@ typedef struct 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
+ * 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
+ * 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 the top of optimizer/path/pathkeys.c
+ * appears at that sort position. (See the top of optimizer/path/pathkeys.c
* for more information.)
*/
@@ -192,11 +199,12 @@ typedef struct PathKeyItem
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 a Func clause representing the value
- * indexed by a functional index. Someday we might allow arbitrary
- * expressions as path keys, so don't assume more than you must.
+ * key typically points to a Var node, ie a relation attribute, but it
+ * can also point to a Func clause representing the value indexed by a
+ * functional index. Someday we might allow arbitrary expressions as
+ * path keys, so don't assume more than you must.
*/
} PathKeyItem;
@@ -212,8 +220,10 @@ typedef struct Path
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) */
+ Cost startup_cost; /* cost expended before fetching any
+ * tuples */
+ Cost total_cost; /* total cost (assuming all tuples
+ * fetched) */
NodeTag pathtype; /* tag identifying scan/join method */
/* XXX why is pathtype separate from the NodeTag? */
@@ -223,10 +233,10 @@ typedef struct Path
} Path;
/*----------
- * IndexPath represents an index scan. Although an indexscan can only read
+ * IndexPath represents an index scan. Although an indexscan can only read
* a single relation, it can scan it more than once, potentially using a
* different index during each scan. The result is the union (OR) of all the
- * tuples matched during any scan. (The executor is smart enough not to return
+ * tuples matched during any scan. (The executor is smart enough not to return
* the same tuple more than once, even if it is matched in multiple scans.)
*
* 'indexid' is a list of index relation OIDs, one per scan to be performed.
@@ -272,10 +282,10 @@ typedef struct IndexPath
typedef struct TidPath
{
- Path path;
- List *tideval;
- Relids unjoined_relids; /* some rels not yet part of my Path */
-} TidPath;
+ Path path;
+ List *tideval;
+ Relids unjoined_relids;/* some rels not yet part of my Path */
+} TidPath;
/*
* All join-type paths share these fields.
@@ -287,8 +297,10 @@ typedef struct JoinPath
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
+ 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;
@@ -303,7 +315,7 @@ 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. (Before 7.0, this was a list of
+ * that will be used in the merge. (Before 7.0, this was a list of
* bare clause expressions, but we can save on list memory by leaving
* it in the form of a RestrictInfo list.)
*
@@ -321,7 +333,8 @@ typedef JoinPath NestPath;
typedef struct MergePath
{
JoinPath jpath;
- List *path_mergeclauses; /* join clauses to be used for merge */
+ 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;
@@ -340,14 +353,14 @@ typedef struct MergePath
typedef struct HashPath
{
JoinPath jpath;
- List *path_hashclauses; /* join clauses used for hashing */
+ 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 clause). Since the restriction clauses are logically ANDed, we
+ * (WHERE 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.
@@ -376,7 +389,7 @@ typedef struct HashPath
* sequence we use. So, these clauses cannot be associated directly with
* the join RelOptInfo, but must be kept track of on a per-join-path basis.
*
- * In general, the referenced clause might be arbitrarily complex. The
+ * In general, the referenced clause might be arbitrarily complex. The
* kinds of clauses we can handle as indexscan quals, mergejoin clauses,
* or hashjoin clauses are fairly limited --- the code for each kind of
* path is responsible for identifying the restrict clauses it can use
@@ -395,16 +408,16 @@ typedef struct RestrictInfo
Expr *clause; /* the represented clause of WHERE cond */
/* only used if clause is an OR clause: */
- List *subclauseindices; /* indexes matching subclauses */
+ List *subclauseindices; /* indexes matching subclauses */
/* subclauseindices is a List of Lists of IndexOptInfos */
/* valid if clause is mergejoinable, else InvalidOid: */
- Oid mergejoinoperator; /* copy of clause operator */
+ Oid mergejoinoperator; /* copy of clause operator */
Oid left_sortop; /* leftside sortop needed for mergejoin */
Oid right_sortop; /* rightside sortop needed for mergejoin */
/* valid if clause is hashjoinable, else InvalidOid: */
- Oid hashjoinoperator; /* copy of clause operator */
+ Oid hashjoinoperator; /* copy of clause operator */
} RestrictInfo;
/*
@@ -424,8 +437,8 @@ typedef struct RestrictInfo
typedef struct JoinInfo
{
NodeTag type;
- Relids unjoined_relids; /* some rels not yet part of my RelOptInfo */
- List *jinfo_restrictinfo; /* relevant RestrictInfos */
+ Relids unjoined_relids;/* some rels not yet part of my RelOptInfo */
+ List *jinfo_restrictinfo; /* relevant RestrictInfos */
} JoinInfo;
/*
@@ -463,7 +476,7 @@ typedef struct Stream
StreamPtr downstream;
bool groupup;
Cost groupcost;
- Selectivity groupsel;
+ Selectivity groupsel;
} Stream;
#endif /* RELATION_H */