summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path')
-rw-r--r--src/backend/optimizer/path/costsize.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c
index a39cc793b4d..54931cd6e2a 100644
--- a/src/backend/optimizer/path/costsize.c
+++ b/src/backend/optimizer/path/costsize.c
@@ -4360,7 +4360,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
path->jpath.jointype))
{
innerbucketsize = 1.0 / virtualbuckets;
- innermcvfreq = 0.0;
+ innermcvfreq = 1.0 / inner_path_rows_total;
}
else
{
@@ -4428,7 +4428,8 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
if (innerbucketsize > thisbucketsize)
innerbucketsize = thisbucketsize;
- if (innermcvfreq > thismcvfreq)
+ /* Disregard zero for MCV freq, it means we have no data */
+ if (thismcvfreq > 0.0 && innermcvfreq > thismcvfreq)
innermcvfreq = thismcvfreq;
}
}