Skip to content

Commit 655393a

Browse files
committed
Fix parallel hash join path search.
When the very cheapest path is not parallel-safe, we want to instead use the cheapest unparameterized path that is. The old code searched innerrel->cheapest_parameterized_paths, but that isn't right, because the path we want may not be in that list. Search innerrel->pathlist instead. Spotted by Dilip Kumar. Discussion: http://postgr.es/m/CAFiTN-szCEcZrQm0i_w4xqSaRUTOUFstNu32Zn4rxxDcoa8gnA@mail.gmail.com
1 parent b2678ef commit 655393a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/optimizer/path/joinpath.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1510,17 +1510,17 @@ hash_inner_and_outer(PlannerInfo *root,
15101510
/*
15111511
* Normally, given that the joinrel is parallel-safe, the cheapest
15121512
* total inner path will also be parallel-safe, but if not, we'll
1513-
* have to search cheapest_parameterized_paths for the cheapest
1514-
* safe, unparameterized inner path. If doing JOIN_UNIQUE_INNER,
1515-
* we can't use any alternative inner path.
1513+
* have to search for the cheapest safe, unparameterized inner
1514+
* path. If doing JOIN_UNIQUE_INNER, we can't use any alternative
1515+
* inner path.
15161516
*/
15171517
if (cheapest_total_inner->parallel_safe)
15181518
cheapest_safe_inner = cheapest_total_inner;
15191519
else if (save_jointype != JOIN_UNIQUE_INNER)
15201520
{
15211521
ListCell *lc;
15221522

1523-
foreach(lc, innerrel->cheapest_parameterized_paths)
1523+
foreach(lc, innerrel->pathlist)
15241524
{
15251525
Path *innerpath = (Path *) lfirst(lc);
15261526

0 commit comments

Comments
 (0)