diff options
| author | Tom Lane | 2002-11-24 21:52:15 +0000 |
|---|---|---|
| committer | Tom Lane | 2002-11-24 21:52:15 +0000 |
| commit | 04c8785c7b2b3dea038522cd96085c710c628c5b (patch) | |
| tree | 728c137a49ae2c3e02a8c00b549543ab23680b75 /src/include/optimizer | |
| parent | 6bfc09baf4043a6b9db9a4bae245973e7557998e (diff) | |
Restructure planning of nestloop inner indexscans so that the set of usable
joinclauses is determined accurately for each join. Formerly, the code only
considered joinclauses that used all of the rels from the outer side of the
join; thus for example
FROM (a CROSS JOIN b) JOIN c ON (c.f1 = a.x AND c.f2 = b.y)
could not exploit a two-column index on c(f1,f2), since neither of the
qual clauses would be in the joininfo list it looked in. The new code does
this correctly, and also is able to eliminate redundant clauses, thus fixing
the problem noted 24-Oct-02 by Hans-Jürgen Schönig.
Diffstat (limited to 'src/include/optimizer')
| -rw-r--r-- | src/include/optimizer/paths.h | 4 | ||||
| -rw-r--r-- | src/include/optimizer/restrictinfo.h | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 4222c77ad97..b03ce0453e6 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -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.60 2002/06/20 20:29:51 momjian Exp $ + * $Id: paths.h,v 1.61 2002/11/24 21:52:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -40,6 +40,8 @@ extern void debug_print_rel(Query *root, RelOptInfo *rel); * routines to generate index paths */ extern void create_index_paths(Query *root, RelOptInfo *rel); +extern Path *best_inner_indexscan(Query *root, RelOptInfo *rel, + Relids outer_relids, JoinType jointype); extern Oid indexable_operator(Expr *clause, Oid opclass, bool indexkey_on_left); extern List *extract_or_indexqual_conditions(RelOptInfo *rel, diff --git a/src/include/optimizer/restrictinfo.h b/src/include/optimizer/restrictinfo.h index 3806415fe8c..997d4ab8c52 100644 --- a/src/include/optimizer/restrictinfo.h +++ b/src/include/optimizer/restrictinfo.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: restrictinfo.h,v 1.15 2002/06/20 20:29:51 momjian Exp $ + * $Id: restrictinfo.h,v 1.16 2002/11/24 21:52:15 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,5 +20,8 @@ extern bool restriction_is_or_clause(RestrictInfo *restrictinfo); extern List *get_actual_clauses(List *restrictinfo_list); extern void get_actual_join_clauses(List *restrictinfo_list, List **joinquals, List **otherquals); +extern List *remove_redundant_join_clauses(Query *root, + List *restrictinfo_list, + JoinType jointype); #endif /* RESTRICTINFO_H */ |
