aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/relation.h33
-rw-r--r--src/include/optimizer/clauses.h4
-rw-r--r--src/include/optimizer/cost.h5
-rw-r--r--src/include/optimizer/restrictinfo.h4
4 files changed, 33 insertions, 13 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index e305870aa7b..416cdb0c55b 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: relation.h,v 1.34 1999/07/15 23:03:56 momjian Exp $
+ * $Id: relation.h,v 1.35 1999/07/24 23:21:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -151,6 +151,23 @@ typedef struct Path
List *loc_restrictinfo;
} Path;
+/*----------
+ * 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
+ * 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.
+ * 'indexqual' is a list of index qualifications, also one per scan.
+ * Each entry in 'indexqual' is a sublist of qualification expressions with
+ * implicit AND semantics across the sublist items. Each one of the sublist
+ * items must be an operator expression of the form (var op something) or
+ * (something op var), where the var is a field the associated index keys on
+ * and the op is a member of the operator class of the index.
+ * NOTE that the semantics of the top-level list in 'indexqual' is OR
+ * combination, while the sublists are implicitly AND combinations!
+ *----------
+ */
typedef struct IndexPath
{
Path path;
@@ -205,16 +222,20 @@ typedef struct JoinKey
} JoinKey;
/*
- * clause info
+ * 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
+ * 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.
*/
typedef struct RestrictInfo
{
NodeTag type;
- Expr *clause; /* should be an OP clause */
- Cost selectivity;
- bool notclause;
- List *indexids;
+ Expr *clause; /* the represented subclause of WHERE cond */
+ Cost selectivity; /* estimated selectivity */
+ List *indexids; /* subclause index IDs if clause is an OR */
/* mergejoin only */
MergeOrder *mergejoinorder;
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index de135ca1d53..e362b7c64d9 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: clauses.h,v 1.21 1999/07/15 23:03:57 momjian Exp $
+ * $Id: clauses.h,v 1.22 1999/07/24 23:21:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -34,13 +34,13 @@ extern Expr *get_notclausearg(Expr *notclause);
extern bool and_clause(Node *clause);
extern Expr *make_andclause(List *andclauses);
+extern Expr *make_ands_explicit(List *andclauses);
extern bool case_clause(Node *clause);
extern List *pull_constant_clauses(List *quals, List **constantQual);
extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause);
-extern bool contains_not(Node *clause);
extern bool is_joinable(Node *clause);
extern bool qual_clause_p(Node *clause);
extern void fix_opid(Node *clause);
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index b9fc7103706..1dfe9752262 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: cost.h,v 1.21 1999/07/15 15:21:20 momjian Exp $
+ * $Id: cost.h,v 1.22 1999/07/24 23:21:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,6 @@ extern void set_clause_selectivities(List *restrictinfo_list, Cost new_selectivi
extern Cost product_selec(List *restrictinfo_list);
extern void set_rest_relselec(Query *root, List *rel_list);
extern void set_rest_selec(Query *root, List *restrictinfo_list);
-extern Cost compute_clause_selec(Query *root,
- Node *clause, List *or_selectivities);
+extern Cost compute_clause_selec(Query *root, Node *clause);
#endif /* COST_H */
diff --git a/src/include/optimizer/restrictinfo.h b/src/include/optimizer/restrictinfo.h
index 2f5c4dca20c..7412ca46fa0 100644
--- a/src/include/optimizer/restrictinfo.h
+++ b/src/include/optimizer/restrictinfo.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: restrictinfo.h,v 1.5 1999/07/15 15:21:23 momjian Exp $
+ * $Id: restrictinfo.h,v 1.6 1999/07/24 23:21:05 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -15,7 +15,7 @@
#include "nodes/relation.h"
-extern bool valid_or_clause(RestrictInfo *restrictinfo);
+extern bool restriction_is_or_clause(RestrictInfo *restrictinfo);
extern List *get_actual_clauses(List *restrictinfo_list);
extern void get_relattvals(List *restrictinfo_list, List **attnos,
List **values, List **flags);