mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Repair planning bugs caused by my misguided removal of restrictinfo link
fields in JoinPaths --- turns out that we do need that after all :-(. Also, rearrange planner so that only one RelOptInfo is created for a particular set of joined base relations, no matter how many different subsets of relations it can be created from. This saves memory and processing time compared to the old method of making a bunch of RelOptInfos and then removing the duplicates. Clean up the jointree iteration logic; not sure if it's better, but I sure find it more readable and plausible now, particularly for the case of 'bushy plans'.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: cost.h,v 1.28 2000/01/26 05:58:20 momjian Exp $
|
||||
* $Id: cost.h,v 1.29 2000/02/07 04:41:04 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -55,9 +55,11 @@ 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);
|
||||
extern void set_baserel_size_estimates(Query *root, RelOptInfo *rel);
|
||||
extern void set_joinrel_size_estimates(Query *root, RelOptInfo *rel,
|
||||
RelOptInfo *outer_rel,
|
||||
RelOptInfo *inner_rel,
|
||||
List *restrictlist);
|
||||
|
||||
/*
|
||||
* prototypes for clausesel.c
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pathnode.h,v 1.24 2000/01/26 05:58:20 momjian Exp $
|
||||
* $Id: pathnode.h,v 1.25 2000/02/07 04:41:04 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -21,8 +21,8 @@
|
||||
*/
|
||||
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);
|
||||
extern void add_path(RelOptInfo *parent_rel, Path *new_path);
|
||||
extern void add_pathlist(RelOptInfo *parent_rel, List *new_paths);
|
||||
|
||||
extern Path *create_seqscan_path(RelOptInfo *rel);
|
||||
extern IndexPath *create_index_path(Query *root, RelOptInfo *rel,
|
||||
@@ -31,25 +31,34 @@ extern IndexPath *create_index_path(Query *root, RelOptInfo *rel,
|
||||
extern TidPath *create_tidscan_path(RelOptInfo *rel, List *tideval);
|
||||
|
||||
extern NestPath *create_nestloop_path(RelOptInfo *joinrel,
|
||||
Path *outer_path, Path *inner_path,
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *restrict_clauses,
|
||||
List *pathkeys);
|
||||
|
||||
extern MergePath *create_mergejoin_path(RelOptInfo *joinrel, Path *outer_path,
|
||||
Path *inner_path, List *pathkeys,
|
||||
extern MergePath *create_mergejoin_path(RelOptInfo *joinrel,
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *restrict_clauses,
|
||||
List *pathkeys,
|
||||
List *mergeclauses,
|
||||
List *outersortkeys,
|
||||
List *innersortkeys);
|
||||
|
||||
extern HashPath *create_hashjoin_path(RelOptInfo *joinrel, Path *outer_path,
|
||||
Path *inner_path, List *hashclauses,
|
||||
extern HashPath *create_hashjoin_path(RelOptInfo *joinrel,
|
||||
Path *outer_path,
|
||||
Path *inner_path,
|
||||
List *restrict_clauses,
|
||||
List *hashclauses,
|
||||
Selectivity innerdisbursion);
|
||||
|
||||
/*
|
||||
* prototypes for rel.c
|
||||
* prototypes for relnode.c
|
||||
*/
|
||||
extern RelOptInfo *rel_member(Relids relid, List *rels);
|
||||
extern RelOptInfo *get_base_rel(Query *root, int relid);
|
||||
extern RelOptInfo *get_join_rel(Query *root, Relids relid);
|
||||
extern RelOptInfo *get_join_rel(Query *root, RelOptInfo *outer_rel,
|
||||
RelOptInfo *inner_rel,
|
||||
List **restrictlist_ptr);
|
||||
|
||||
/*
|
||||
* prototypes for indexnode.h
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: paths.h,v 1.41 2000/02/06 03:27:35 tgl Exp $
|
||||
* $Id: paths.h,v 1.42 2000/02/07 04:41:04 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -27,15 +27,15 @@
|
||||
extern bool enable_geqo;
|
||||
extern int geqo_rels;
|
||||
|
||||
extern RelOptInfo *make_one_rel(Query *root, List *rels);
|
||||
extern RelOptInfo *make_one_rel(Query *root);
|
||||
|
||||
/*
|
||||
* indxpath.c
|
||||
* routines to generate index paths
|
||||
*/
|
||||
extern List *create_index_paths(Query *root, RelOptInfo *rel, List *indices,
|
||||
List *restrictinfo_list,
|
||||
List *joininfo_list);
|
||||
List *restrictinfo_list,
|
||||
List *joininfo_list);
|
||||
extern Oid indexable_operator(Expr *clause, Oid opclass, Oid relam,
|
||||
bool indexkey_on_left);
|
||||
extern List *extract_or_indexqual_conditions(RelOptInfo *rel,
|
||||
@@ -60,7 +60,22 @@ extern List *create_tidscan_paths(Query *root, RelOptInfo *rel);
|
||||
* joinpath.c
|
||||
* routines to create join paths
|
||||
*/
|
||||
extern void update_rels_pathlist_for_joins(Query *root, List *joinrels);
|
||||
extern void add_paths_to_joinrel(Query *root, RelOptInfo *joinrel,
|
||||
RelOptInfo *outerrel,
|
||||
RelOptInfo *innerrel,
|
||||
List *restrictlist);
|
||||
|
||||
/*
|
||||
* joinrels.c
|
||||
* routines to determine which relations to join
|
||||
*/
|
||||
extern void make_rels_by_joins(Query *root, int level);
|
||||
extern RelOptInfo *make_rels_by_clause_joins(Query *root,
|
||||
RelOptInfo *old_rel,
|
||||
List *other_rels);
|
||||
extern RelOptInfo *make_rels_by_clauseless_joins(Query *root,
|
||||
RelOptInfo *old_rel,
|
||||
List *other_rels);
|
||||
|
||||
/*
|
||||
* pathkeys.c
|
||||
@@ -90,22 +105,4 @@ extern List *find_mergeclauses_for_pathkeys(List *pathkeys,
|
||||
extern List *make_pathkeys_for_mergeclauses(List *mergeclauses,
|
||||
List *tlist);
|
||||
|
||||
/*
|
||||
* joinrels.c
|
||||
* routines to determine which relations to join
|
||||
*/
|
||||
extern List *make_rels_by_joins(Query *root, List *old_rels);
|
||||
extern List *make_rels_by_clause_joins(Query *root, RelOptInfo *old_rel,
|
||||
List *joininfo_list, Relids only_relids);
|
||||
extern List *make_rels_by_clauseless_joins(RelOptInfo *old_rel,
|
||||
List *inner_rels);
|
||||
extern RelOptInfo *get_cheapest_complete_rel(List *join_rel_list);
|
||||
|
||||
/*
|
||||
* prune.c
|
||||
*/
|
||||
extern void merge_rels_with_same_relids(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 */
|
||||
|
||||
Reference in New Issue
Block a user