summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane2004-01-04 03:51:52 +0000
committerTom Lane2004-01-04 03:51:52 +0000
commit82b4dd394f50f75a34d3ddc1c7d54b8d8fcace33 (patch)
tree1fb959074c117f48b987a77e7632ec6bbcc583da /src/include
parent21a12022818b6ac418d7a1544e92f8b13d61cc91 (diff)
Merge restrictlist_selectivity into clauselist_selectivity by
teaching the latter to accept either RestrictInfo nodes or bare clause expressions; and cache the selectivity result in the RestrictInfo node when possible. This extends the caching behavior of approx_selectivity to many more contexts, and should reduce duplicate selectivity calculations.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/relation.h7
-rw-r--r--src/include/optimizer/clauses.h3
-rw-r--r--src/include/optimizer/cost.h6
3 files changed, 7 insertions, 9 deletions
diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h
index af852725737..010adcc8592 100644
--- a/src/include/nodes/relation.h
+++ b/src/include/nodes/relation.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.89 2004/01/04 00:07:32 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.90 2004/01/04 03:51:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -613,6 +613,9 @@ typedef struct RestrictInfo
*/
bool canjoin;
+ /* The set of relids (varnos) referenced in the clause: */
+ Relids clause_relids;
+
/* These fields are set for any binary opclause: */
Relids left_relids; /* relids in left side of clause */
Relids right_relids; /* relids in right side of clause */
@@ -620,7 +623,7 @@ typedef struct RestrictInfo
/* This field is NULL unless clause is an OR clause: */
Expr *orclause; /* modified clause with RestrictInfos */
- /* cache space for costs (currently only used for join clauses) */
+ /* cache space for cost and selectivity */
QualCost eval_cost; /* eval cost of clause; -1 if not yet set */
Selectivity this_selec; /* selectivity; -1 if not yet set */
diff --git a/src/include/optimizer/clauses.h b/src/include/optimizer/clauses.h
index 3e089256a51..c948a9039fb 100644
--- a/src/include/optimizer/clauses.h
+++ b/src/include/optimizer/clauses.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.70 2003/12/30 23:53:15 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/clauses.h,v 1.71 2004/01/04 03:51:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,6 @@ extern List *pull_constant_clauses(List *quals, List **constantQual);
extern bool has_distinct_on_clause(Query *query);
-extern void clause_get_relids_vars(Node *clause, Relids *relids, List **vars);
extern int NumRelids(Node *clause);
extern void CommuteClause(OpExpr *clause);
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index 316d63b97a2..15540a66643 100644
--- a/src/include/optimizer/cost.h
+++ b/src/include/optimizer/cost.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.58 2003/11/29 22:41:07 pgsql Exp $
+ * $PostgreSQL: pgsql/src/include/optimizer/cost.h,v 1.59 2004/01/04 03:51:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,10 +88,6 @@ extern void set_function_size_estimates(Query *root, RelOptInfo *rel);
* prototypes for clausesel.c
* routines to compute clause selectivities
*/
-extern Selectivity restrictlist_selectivity(Query *root,
- List *restrictinfo_list,
- int varRelid,
- JoinType jointype);
extern Selectivity clauselist_selectivity(Query *root,
List *clauses,
int varRelid,