aboutsummaryrefslogtreecommitdiff
path: root/src/include/optimizer
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/optimizer')
-rw-r--r--src/include/optimizer/cost.h46
-rw-r--r--src/include/optimizer/pathnode.h31
-rw-r--r--src/include/optimizer/paths.h8
-rw-r--r--src/include/optimizer/plancat.h20
-rw-r--r--src/include/optimizer/planmain.h5
5 files changed, 53 insertions, 57 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h
index abde39b237c..c654b6953e7 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.24 1999/11/23 20:07:05 momjian Exp $
+ * $Id: cost.h,v 1.25 2000/01/09 00:26:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,34 +33,28 @@ extern bool _enable_mergejoin_;
extern bool _enable_hashjoin_;
extern bool _enable_tidscan_;
-extern Cost cost_seqscan(int relid, int relpages, int reltuples);
-extern Cost cost_index(Oid indexid, int expected_indexpages, Cost selec,
- int relpages, int reltuples, int indexpages,
- int indextuples, bool is_injoin);
-extern Cost cost_tidscan(List *evallist);
-extern Cost cost_sort(List *pathkeys, int tuples, int width);
-extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples,
- int innertuples, int outerpages, bool is_indexjoin);
-extern Cost cost_mergejoin(Cost outercost, Cost innercost,
- List *outersortkeys, List *innersortkeys,
- int outersize, int innersize, int outerwidth, int innerwidth);
-extern Cost cost_hashjoin(Cost outercost, Cost innercost,
- int outersize, int innersize,
- int outerwidth, int innerwidth,
- Cost innerdisbursion);
-extern int compute_rel_size(RelOptInfo *rel);
-extern int compute_rel_width(RelOptInfo *rel);
-extern int compute_joinrel_size(JoinPath *joinpath);
-extern int page_size(int tuples, int width);
+extern Cost cost_seqscan(RelOptInfo *baserel);
+extern Cost cost_index(RelOptInfo *baserel, IndexOptInfo *index,
+ long expected_indexpages, Selectivity selec,
+ bool is_injoin);
+extern Cost cost_tidscan(RelOptInfo *baserel, List *tideval);
+extern Cost cost_sort(List *pathkeys, double tuples, int width);
+extern Cost cost_nestloop(Path *outer_path, Path *inner_path,
+ bool is_indexjoin);
+extern Cost cost_mergejoin(Path *outer_path, Path *inner_path,
+ List *outersortkeys, List *innersortkeys);
+extern Cost cost_hashjoin(Path *outer_path, Path *inner_path,
+ Selectivity innerdisbursion);
+extern void set_rel_rows_width(Query *root, RelOptInfo *rel);
+extern void set_joinrel_rows_width(Query *root, RelOptInfo *rel,
+ JoinPath *joinpath);
/*
- * prototypes for fuctions in clausesel.h
+ * prototypes for clausesel.c
* routines to compute clause selectivities
*/
-extern void set_clause_selectivities(List *restrictinfo_list, Cost new_selectivity);
-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);
+extern Selectivity restrictlist_selec(Query *root, List *restrictinfo_list);
+extern Selectivity clauselist_selec(Query *root, List *clauses);
+extern Selectivity compute_clause_selec(Query *root, Node *clause);
#endif /* COST_H */
diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h
index 2aca95e605d..25781a34476 100644
--- a/src/include/optimizer/pathnode.h
+++ b/src/include/optimizer/pathnode.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: pathnode.h,v 1.22 1999/11/23 20:07:06 momjian Exp $
+ * $Id: pathnode.h,v 1.23 2000/01/09 00:26:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -21,26 +21,27 @@
extern bool path_is_cheaper(Path *path1, Path *path2);
extern Path *set_cheapest(RelOptInfo *parent_rel, List *pathlist);
extern List *add_pathlist(RelOptInfo *parent_rel, List *old_paths,
- List *new_paths);
+ List *new_paths);
extern Path *create_seqscan_path(RelOptInfo *rel);
-
extern IndexPath *create_index_path(Query *root, RelOptInfo *rel,
- RelOptInfo *index, List *restriction_clauses);
+ IndexOptInfo *index,
+ List *restriction_clauses);
extern TidPath *create_tidscan_path(RelOptInfo *rel, List *tideval);
extern NestPath *create_nestloop_path(RelOptInfo *joinrel,
- RelOptInfo *outer_rel, Path *outer_path, Path *inner_path,
- List *pathkeys);
-
-extern MergePath *create_mergejoin_path(RelOptInfo *joinrel, int outersize,
- int innersize, int outerwidth, int innerwidth, Path *outer_path,
- Path *inner_path, List *pathkeys,
- List *mergeclauses, List *outersortkeys, List *innersortkeys);
-
-extern HashPath *create_hashjoin_path(RelOptInfo *joinrel, int outersize,
- int innersize, int outerwidth, int innerwidth, Path *outer_path,
- Path *inner_path, List *hashclauses, Cost innerdisbursion);
+ Path *outer_path, Path *inner_path,
+ List *pathkeys);
+
+extern MergePath *create_mergejoin_path(RelOptInfo *joinrel, Path *outer_path,
+ Path *inner_path, List *pathkeys,
+ List *mergeclauses,
+ List *outersortkeys,
+ List *innersortkeys);
+
+extern HashPath *create_hashjoin_path(RelOptInfo *joinrel, Path *outer_path,
+ Path *inner_path, List *hashclauses,
+ Selectivity innerdisbursion);
/*
* prototypes for rel.c
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h
index 92ce9f9719f..a3f6bad36be 100644
--- a/src/include/optimizer/paths.h
+++ b/src/include/optimizer/paths.h
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: paths.h,v 1.36 1999/11/23 20:07:06 momjian Exp $
+ * $Id: paths.h,v 1.37 2000/01/09 00:26:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,8 @@ extern RelOptInfo *make_one_rel(Query *root, List *rels);
extern List *create_index_paths(Query *root, RelOptInfo *rel, List *indices,
List *restrictinfo_list,
List *joininfo_list);
+extern Oid indexable_operator(Expr *clause, Oid opclass, Oid relam,
+ bool indexkey_on_left);
extern List *expand_indexqual_conditions(List *indexquals);
/*
@@ -65,7 +67,7 @@ extern bool pathkeys_contained_in(List *keys1, List *keys2);
extern Path *get_cheapest_path_for_pathkeys(List *paths, List *pathkeys,
bool indexpaths_only);
extern List *build_index_pathkeys(Query *root, RelOptInfo *rel,
- RelOptInfo *index);
+ IndexOptInfo *index);
extern List *build_join_pathkeys(List *outer_pathkeys,
List *join_rel_tlist, List *joinclauses);
extern bool commute_pathkeys(List *pathkeys);
@@ -93,7 +95,7 @@ extern bool is_subset(List *s1, List *s2);
* prototypes for path/prune.c
*/
extern void merge_rels_with_same_relids(List *rel_list);
-extern void rels_set_cheapest(List *rel_list);
+extern void rels_set_cheapest(Query *root, List *rel_list);
extern List *del_rels_all_bushy_inactive(List *old_rels);
#endif /* PATHS_H */
diff --git a/src/include/optimizer/plancat.h b/src/include/optimizer/plancat.h
index 34c853d68f8..307b51c3f42 100644
--- a/src/include/optimizer/plancat.h
+++ b/src/include/optimizer/plancat.h
@@ -6,36 +6,36 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: plancat.h,v 1.14 1999/11/21 23:25:42 tgl Exp $
+ * $Id: plancat.h,v 1.15 2000/01/09 00:26:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PLANCAT_H
#define PLANCAT_H
-#include "nodes/parsenodes.h"
+#include "nodes/relation.h"
extern void relation_info(Query *root, Index relid,
- bool *hasindex, int *pages, int *tuples);
+ bool *hasindex, long *pages, double *tuples);
extern List *find_secondary_indexes(Query *root, Index relid);
-extern Cost restriction_selectivity(Oid functionObjectId,
+extern List *find_inheritance_children(Oid inhparent);
+
+extern Selectivity restriction_selectivity(Oid functionObjectId,
Oid operatorObjectId,
Oid relationObjectId,
AttrNumber attributeNumber,
Datum constValue,
int constFlag);
-extern void index_selectivity(Query *root, int relid, Oid indexid,
- List *indexquals,
- float *idxPages, float *idxSelec);
+extern void index_selectivity(Query *root, RelOptInfo *rel,
+ IndexOptInfo *index, List *indexquals,
+ long *idxPages, Selectivity *idxSelec);
-extern Cost join_selectivity(Oid functionObjectId, Oid operatorObjectId,
+extern Selectivity join_selectivity(Oid functionObjectId, Oid operatorObjectId,
Oid relationObjectId1, AttrNumber attributeNumber1,
Oid relationObjectId2, AttrNumber attributeNumber2);
-extern List *find_inheritance_children(Oid inhparent);
-
#endif /* PLANCAT_H */
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h
index 8664fb9aaae..409559a6960 100644
--- a/src/include/optimizer/planmain.h
+++ b/src/include/optimizer/planmain.h
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: planmain.h,v 1.34 1999/10/07 04:23:19 tgl Exp $
+ * $Id: planmain.h,v 1.35 2000/01/09 00:26:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -24,7 +24,7 @@ extern Plan *query_planner(Query *root, List *tlist, List *qual);
/*
* prototypes for plan/createplan.c
*/
-extern Plan *create_plan(Path *best_path);
+extern Plan *create_plan(Query *root, Path *best_path);
extern SeqScan *make_seqscan(List *qptlist, List *qpqual, Index scanrelid);
extern Sort *make_sort(List *tlist, Oid nonameid, Plan *lefttree,
int keycount);
@@ -41,7 +41,6 @@ extern Result *make_result(List *tlist, Node *resconstantqual, Plan *subplan);
extern void make_var_only_tlist(Query *root, List *tlist);
extern void add_restrict_and_join_to_rels(Query *root, List *clauses);
extern void add_missing_rels_to_query(Query *root);
-extern void set_joininfo_mergeable_hashable(List *rel_list);
/*
* prototypes for plan/setrefs.c