From c473d923515e03fe5fd43c2ca15d52363a93f488 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 6 Feb 2009 23:43:24 +0000 Subject: Fix cost_mergejoin's failure to adjust for rescanning of non-unique merge join keys when considering a semi or anti join. This requires estimating the selectivity of the merge qual as though it were a regular inner join condition. To allow caching both that and the real outer-join-aware selectivity, split RestrictInfo.this_selec into two fields. This fixes one of the problems reported by Kevin Grittner. --- src/backend/optimizer/path/orindxpath.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/backend/optimizer/path/orindxpath.c') diff --git a/src/backend/optimizer/path/orindxpath.c b/src/backend/optimizer/path/orindxpath.c index a82f1c8b82..638078e169 100644 --- a/src/backend/optimizer/path/orindxpath.c +++ b/src/backend/optimizer/path/orindxpath.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.86 2009/01/01 17:23:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/path/orindxpath.c,v 1.87 2009/02/06 23:43:23 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -174,10 +174,11 @@ create_or_index_quals(PlannerInfo *root, RelOptInfo *rel) { orig_selec = clause_selectivity(root, (Node *) bestrinfo, 0, JOIN_INNER, NULL); - bestrinfo->this_selec = orig_selec / or_selec; + bestrinfo->norm_selec = orig_selec / or_selec; /* clamp result to sane range */ - if (bestrinfo->this_selec > 1) - bestrinfo->this_selec = 1; + if (bestrinfo->norm_selec > 1) + bestrinfo->norm_selec = 1; + /* It isn't an outer join clause, so no need to adjust outer_selec */ } /* Tell caller to recompute rel's rows estimate */ -- cgit v1.2.1