diff options
| author | Tom Lane | 1999-08-06 04:00:17 +0000 |
|---|---|---|
| committer | Tom Lane | 1999-08-06 04:00:17 +0000 |
| commit | e1fad50a5d362d78b9f571b71b372faaa597462a (patch) | |
| tree | fb7953f8d6bb903be4d1ee6e4c3ddc3a9ea4ad26 /src/include | |
| parent | b7883d7e3a1d7d3d98b2bd8186ddf60011d45bdd (diff) | |
Revise generation of hashjoin paths: generate one path per
hashjoinable clause, not one path for a randomly-chosen element of each
set of clauses with the same join operator. That is, if you wrote
SELECT ... WHERE t1.f1 = t2.f2 and t1.f3 = t2.f4,
and both '=' ops were the same opcode (say, all four fields are int4),
then the system would either consider hashing on f1=f2 or on f3=f4,
but it would *not* consider both possibilities. Boo hiss.
Also, revise estimation of hashjoin costs to include a penalty when the
inner join var has a high disbursion --- ie, the most common value is
pretty common. This tends to lead to badly skewed hash bucket occupancy
and way more comparisons than you'd expect on average.
I imagine that the cost calculation still needs tweaking, but at least
it generates a more reasonable plan than before on George Young's example.
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/optimizer/cost.h | 10 | ||||
| -rw-r--r-- | src/include/optimizer/pathnode.h | 8 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/include/optimizer/cost.h b/src/include/optimizer/cost.h index 1dfe9752262..6791435a4d1 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.22 1999/07/24 23:21:05 tgl Exp $ + * $Id: cost.h,v 1.23 1999/08/06 04:00:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -28,7 +28,6 @@ extern bool _enable_seqscan_; extern bool _enable_indexscan_; extern bool _enable_sort_; -extern bool _enable_hash_; extern bool _enable_nestloop_; extern bool _enable_mergejoin_; extern bool _enable_hashjoin_; @@ -43,9 +42,10 @@ extern Cost cost_nestloop(Cost outercost, Cost innercost, int outertuples, 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, List *outerkeys, - List *innerkeys, 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); diff --git a/src/include/optimizer/pathnode.h b/src/include/optimizer/pathnode.h index b38284ccbe1..aa5be0661e3 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.19 1999/07/30 04:07:22 tgl Exp $ + * $Id: pathnode.h,v 1.20 1999/08/06 04:00:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -33,9 +33,9 @@ extern MergePath *create_mergejoin_path(RelOptInfo *joinrel, int outersize, 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 *pathkeys, Oid operator, List *hashclauses, - List *outerkeys, List *innerkeys); + int innersize, int outerwidth, int innerwidth, Path *outer_path, + Path *inner_path, List *pathkeys, Oid operator, List *hashclauses, + List *outerkeys, List *innerkeys, Cost innerdisbursion); /* * prototypes for rel.c |
