summaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>1999-07-24 23:21:14 +0000
committerTom Lane <tgl@sss.pgh.pa.us>1999-07-24 23:21:14 +0000
commitac4913a0dd433ac1c2207014f886338f2ccd5fef (patch)
treed959e2082fcd500541ccdc9875b093b40c7d116a /src/include/optimizer
parent348bdbce7942324dd19349d4d6f3f7dabae219c3 (diff)
downloadpostgresql-ac4913a0dd433ac1c2207014f886338f2ccd5fef.tar.gz
Clean up messy clause-selectivity code in clausesel.c; repair bug
identified by Hiroshi (incorrect cost attributed to OR clauses after multiple passes through set_rest_selec()). I think the code was trying to allow selectivities of OR subclauses to be passed in from outside, but noplace was actually passing any useful data, and set_rest_selec() was passing wrong data. Restructure representation of "indexqual" in IndexPath nodes so that it is the same as for indxqual in completed IndexScan nodes: namely, a toplevel list with an entry for each pass of the index scan, having sublists that are implicitly-ANDed index qual conditions for that pass. You don't want to know what the old representation was :-( Improve documentation of OR-clause indexscan functions. Remove useless 'notclause' field from RestrictInfo nodes. (This might force an initdb for anyone who has stored rules containing RestrictInfos, but I do not think that RestrictInfo ever appears in completed plans.)
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/clauses.h4
-rw-r--r--src/include/optimizer/cost.h5
-rw-r--r--src/include/optimizer/restrictinfo.h4
3 files changed, 6 insertions, 7 deletions
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index de135ca1d5..e362b7c64d 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 b9fc710370..1dfe975226 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 2f5c4dca20..7412ca46fa 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);