Skip to content

Commit 1ea60ad

Browse files
committed
Fix failure to use clamp_row_est() for parallel joins.
Commit 0c2070c neglected to use clamp_row_est() where it should have done so. Patch by me. Report by Amit Kapila. Discussion: http://postgr.es/m/CAA4eK1KPm8RYa1Kun3ZmQj9pb723b-EFN70j47Pid1vn3ByquA@mail.gmail.com
1 parent c583234 commit 1ea60ad

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/backend/optimizer/path/costsize.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2147,7 +2147,12 @@ final_cost_nestloop(PlannerInfo *root, NestPath *path,
21472147

21482148
/* For partial paths, scale row estimate. */
21492149
if (path->path.parallel_workers > 0)
2150-
path->path.rows /= get_parallel_divisor(&path->path);
2150+
{
2151+
double parallel_divisor = get_parallel_divisor(&path->path);
2152+
2153+
path->path.rows =
2154+
clamp_row_est(path->path.rows / parallel_divisor);
2155+
}
21512156

21522157
/*
21532158
* We could include disable_cost in the preliminary estimate, but that
@@ -2569,7 +2574,12 @@ final_cost_mergejoin(PlannerInfo *root, MergePath *path,
25692574

25702575
/* For partial paths, scale row estimate. */
25712576
if (path->jpath.path.parallel_workers > 0)
2572-
path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path);
2577+
{
2578+
double parallel_divisor = get_parallel_divisor(&path->jpath.path);
2579+
2580+
path->jpath.path.rows =
2581+
clamp_row_est(path->jpath.path.rows / parallel_divisor);
2582+
}
25732583

25742584
/*
25752585
* We could include disable_cost in the preliminary estimate, but that
@@ -2952,7 +2962,12 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
29522962

29532963
/* For partial paths, scale row estimate. */
29542964
if (path->jpath.path.parallel_workers > 0)
2955-
path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path);
2965+
{
2966+
double parallel_divisor = get_parallel_divisor(&path->jpath.path);
2967+
2968+
path->jpath.path.rows =
2969+
clamp_row_est(path->jpath.path.rows / parallel_divisor);
2970+
}
29562971

29572972
/*
29582973
* We could include disable_cost in the preliminary estimate, but that

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy