summaryrefslogtreecommitdiff
path: root/src/include/nodes/relation.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2003-02-08 20:20:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2003-02-08 20:20:55 +0000
commitc15a4c2aef3ca78a530778b735d43aa04d103ea6 (patch)
tree3106de03d9476a891c6e85cbf5dd477c8661f087 /src/include/nodes/relation.h
parent893678eda7de9db57beccfd2755836c1bea39112 (diff)
downloadpostgresql-c15a4c2aef3ca78a530778b735d43aa04d103ea6.tar.gz
Replace planner's representation of relation sets, per pghackers discussion.
Instead of Lists of integers, we now store variable-length bitmap sets. This should be faster as well as less error-prone.
Diffstat (limited to 'src/include/nodes/relation.h')
-rw-r--r--src/include/nodes/relation.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index 807c70073d..03240d6415 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: relation.h,v 1.78 2003/02/03 15:07:08 tgl Exp $
+ * $Id: relation.h,v 1.79 2003/02/08 20:20:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,16 +15,16 @@
#define RELATION_H
#include "access/sdir.h"
+#include "nodes/bitmapset.h"
#include "nodes/parsenodes.h"
+
/*
* Relids
- * List of relation identifiers (indexes into the rangetable).
- *
- * Note: these are lists of integers, not Nodes.
+ * Set of relation identifiers (indexes into the rangetable).
*/
-typedef List *Relids;
+typedef Bitmapset *Relids;
/*
* When looking for a "cheapest path", this enum specifies whether we want
@@ -83,7 +83,7 @@ typedef struct QualCost
* Parts of this data structure are specific to various scan and join
* mechanisms. It didn't seem worth creating new node types for them.
*
- * relids - List of base-relation identifiers; it is a base relation
+ * relids - Set of base-relation identifiers; it is a base relation
* if there is just one, a join relation if more than one
* rows - estimated number of tuples in the relation after restriction
* clauses have been applied (ie, output rows of a plan for it)
@@ -104,6 +104,8 @@ typedef struct QualCost
*
* If the relation is a base relation it will have these fields set:
*
+ * relid - RTE index (this is redundant with the relids field, but
+ * is provided for convenience of access)
* rtekind - distinguishes plain relation, subquery, or function RTE
* varlist - list of Vars for physical columns (only if table)
* indexlist - list of IndexOptInfo nodes for relation's indexes
@@ -128,12 +130,12 @@ typedef struct QualCost
* baserestrictcost - Estimated cost of evaluating the baserestrictinfo
* clauses at a single tuple (only used for base rels)
* outerjoinset - For a base rel: if the rel appears within the nullable
- * side of an outer join, the list of all relids
- * participating in the highest such outer join; else NIL.
+ * side of an outer join, the set of all relids
+ * participating in the highest such outer join; else NULL.
* Otherwise, unused.
* joininfo - List of JoinInfo nodes, containing info about each join
* clause in which this relation participates
- * index_outer_relids - only used for base rels; list of outer relids
+ * index_outer_relids - only used for base rels; set of outer relids
* that participate in indexable joinclauses for this rel
* index_inner_paths - only used for base rels; list of InnerIndexscanInfo
* nodes showing best indexpaths for various subsets of
@@ -174,8 +176,7 @@ typedef struct RelOptInfo
RelOptKind reloptkind;
/* all relations included in this RelOptInfo */
- Relids relids; /* integer list of base relids (rangetable
- * indexes) */
+ Relids relids; /* set of base relids (rangetable indexes) */
/* size estimates generated by planner */
double rows; /* estimated number of result tuples */
@@ -190,6 +191,7 @@ typedef struct RelOptInfo
bool pruneable;
/* information about a base rel (not set for join rels!) */
+ Index relid;
RTEKind rtekind; /* RELATION, SUBQUERY, or FUNCTION */
List *varlist;
List *indexlist;
@@ -201,7 +203,7 @@ typedef struct RelOptInfo
List *baserestrictinfo; /* RestrictInfo structures (if
* base rel) */
QualCost baserestrictcost; /* cost of evaluating the above */
- Relids outerjoinset; /* integer list of base relids */
+ Relids outerjoinset; /* set of base relids */
List *joininfo; /* JoinInfo structures */
/* cached info about inner indexscan paths for relation: */
@@ -585,11 +587,11 @@ typedef struct RestrictInfo
/*
* If the clause looks useful for joining --- that is, it is a binary
* opclause with nonoverlapping sets of relids referenced in the left
- * and right sides --- then these two fields are set to lists of the
- * referenced relids. Otherwise they are both NIL.
+ * and right sides --- then these two fields are set to sets of the
+ * referenced relids. Otherwise they are both NULL.
*/
- List *left_relids; /* relids in left side of join clause */
- List *right_relids; /* relids in right side of join clause */
+ Relids left_relids; /* relids in left side of join clause */
+ Relids right_relids; /* relids in right side of join clause */
/* valid if clause is mergejoinable, else InvalidOid: */
Oid mergejoinoperator; /* copy of clause operator */
@@ -683,8 +685,8 @@ typedef struct InnerIndexscanInfo
typedef struct InClauseInfo
{
NodeTag type;
- List *lefthand; /* base relids in lefthand expressions */
- List *righthand; /* base relids coming from the subselect */
+ Relids lefthand; /* base relids in lefthand expressions */
+ Relids righthand; /* base relids coming from the subselect */
List *sub_targetlist; /* targetlist of original RHS subquery */
/*
* Note: sub_targetlist is just a list of Vars or expressions;