1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

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
This commit is contained in:
Robert Haas
2017-03-07 10:22:07 -05:00
parent b2678efd43
commit 655393a022

View File

@ -1510,9 +1510,9 @@ hash_inner_and_outer(PlannerInfo *root,
/* /*
* Normally, given that the joinrel is parallel-safe, the cheapest * Normally, given that the joinrel is parallel-safe, the cheapest
* total inner path will also be parallel-safe, but if not, we'll * total inner path will also be parallel-safe, but if not, we'll
* have to search cheapest_parameterized_paths for the cheapest * have to search for the cheapest safe, unparameterized inner
* safe, unparameterized inner path. If doing JOIN_UNIQUE_INNER, * path. If doing JOIN_UNIQUE_INNER, we can't use any alternative
* we can't use any alternative inner path. * inner path.
*/ */
if (cheapest_total_inner->parallel_safe) if (cheapest_total_inner->parallel_safe)
cheapest_safe_inner = cheapest_total_inner; cheapest_safe_inner = cheapest_total_inner;
@ -1520,7 +1520,7 @@ hash_inner_and_outer(PlannerInfo *root,
{ {
ListCell *lc; ListCell *lc;
foreach(lc, innerrel->cheapest_parameterized_paths) foreach(lc, innerrel->pathlist)
{ {
Path *innerpath = (Path *) lfirst(lc); Path *innerpath = (Path *) lfirst(lc);