1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-27 00:12:01 +03:00

Fix GEQO to work again in CVS tip, by being more careful about memory

allocation in best_inner_indexscan().  While at it, simplify GEQO's
interface to the main planner --- make_join_rel() offers exactly the
API it really wants, whereas calling make_rels_by_clause_joins() and
make_rels_by_clauseless_joins() required jumping through hoops.
Rewrite gimme_tree for clarity (sometimes iteration is much better than
recursion), and approximately halve GEQO's runtime by recognizing that
tours of the forms (a,b,c,d,...) and (b,a,c,d,...) are equivalent
because of symmetry in make_join_rel().
This commit is contained in:
Tom Lane
2002-12-16 21:30:30 +00:00
parent 9cecff0314
commit 9f76d0d926
7 changed files with 118 additions and 81 deletions

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: geqo.h,v 1.29 2002/07/20 04:59:10 momjian Exp $
* $Id: geqo.h,v 1.30 2002/12/16 21:30:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,7 +74,6 @@ extern RelOptInfo *geqo(Query *root, int number_of_rels, List *initial_rels);
extern Cost geqo_eval(Query *root, List *initial_rels,
Gene *tour, int num_gene);
extern RelOptInfo *gimme_tree(Query *root, List *initial_rels,
Gene *tour, int num_gene,
int rel_count, RelOptInfo *old_rel);
Gene *tour, int num_gene);
#endif /* GEQO_H */

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: paths.h,v 1.62 2002/12/12 15:49:41 tgl Exp $
* $Id: paths.h,v 1.63 2002/12/16 21:30:30 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,13 +74,10 @@ extern void add_paths_to_joinrel(Query *root, RelOptInfo *joinrel,
* routines to determine which relations to join
*/
extern List *make_rels_by_joins(Query *root, int level, List **joinrels);
extern List *make_rels_by_clause_joins(Query *root,
RelOptInfo *old_rel,
List *other_rels);
extern List *make_rels_by_clauseless_joins(Query *root,
RelOptInfo *old_rel,
List *other_rels);
extern RelOptInfo *make_jointree_rel(Query *root, Node *jtnode);
extern RelOptInfo *make_join_rel(Query *root,
RelOptInfo *rel1, RelOptInfo *rel2,
JoinType jointype);
/*
* pathkeys.c