Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5feb78a

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 18dc2ae commit 5feb78a

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

src/backend/optimizer/path/costsize.c

+18-3
Original file line numberDiff line numberDiff line change
@@ -1998,7 +1998,12 @@ final_cost_nestloop(PlannerInfo *root, NestPath *path,
19981998

19991999
/* For partial paths, scale row estimate. */
20002000
if (path->path.parallel_workers > 0)
2001-
path->path.rows /= get_parallel_divisor(&path->path);
2001+
{
2002+
double parallel_divisor = get_parallel_divisor(&path->path);
2003+
2004+
path->path.rows =
2005+
clamp_row_est(path->path.rows / parallel_divisor);
2006+
}
20022007

20032008
/*
20042009
* We could include disable_cost in the preliminary estimate, but that
@@ -2420,7 +2425,12 @@ final_cost_mergejoin(PlannerInfo *root, MergePath *path,
24202425

24212426
/* For partial paths, scale row estimate. */
24222427
if (path->jpath.path.parallel_workers > 0)
2423-
path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path);
2428+
{
2429+
double parallel_divisor = get_parallel_divisor(&path->jpath.path);
2430+
2431+
path->jpath.path.rows =
2432+
clamp_row_est(path->jpath.path.rows / parallel_divisor);
2433+
}
24242434

24252435
/*
24262436
* We could include disable_cost in the preliminary estimate, but that
@@ -2803,7 +2813,12 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
28032813

28042814
/* For partial paths, scale row estimate. */
28052815
if (path->jpath.path.parallel_workers > 0)
2806-
path->jpath.path.rows /= get_parallel_divisor(&path->jpath.path);
2816+
{
2817+
double parallel_divisor = get_parallel_divisor(&path->jpath.path);
2818+
2819+
path->jpath.path.rows =
2820+
clamp_row_est(path->jpath.path.rows / parallel_divisor);
2821+
}
28072822

28082823
/*
28092824
* We could include disable_cost in the preliminary estimate, but that

0 commit comments

Comments
 (0)