* consider_parallel_nestloop * Try to build partial paths for a joinrel by joining a partial path for the * outer relation to a complete path for the inner relation. * * 'joinrel' is the join relation * 'outerrel' is the outer join relation * 'innerrel' is the inner join relation * 'jointype' is the type of join to do * 'extra' contains additional input values */
| 2032 | * 'extra' contains additional input values |
| 2033 | */ |
| 2034 | static void |
| 2035 | consider_parallel_nestloop(PlannerInfo *root, |
| 2036 | RelOptInfo *joinrel, |
| 2037 | RelOptInfo *outerrel, |
| 2038 | RelOptInfo *innerrel, |
| 2039 | JoinType jointype, |
| 2040 | JoinPathExtraData *extra) |
| 2041 | { |
| 2042 | JoinType save_jointype = jointype; |
| 2043 | ListCell *lc1; |
| 2044 | |
| 2045 | if (jointype == JOIN_UNIQUE_INNER) |
| 2046 | jointype = JOIN_INNER; |
| 2047 | |
| 2048 | if (jointype == JOIN_DEDUP_SEMI || jointype == JOIN_DEDUP_SEMI_REVERSE) |
| 2049 | jointype = JOIN_INNER; |
| 2050 | |
| 2051 | foreach(lc1, outerrel->partial_pathlist) |
| 2052 | { |
| 2053 | Path *outerpath = (Path *) lfirst(lc1); |
| 2054 | List *pathkeys; |
| 2055 | ListCell *lc2; |
| 2056 | |
| 2057 | /* Figure out what useful ordering any paths we create will have. */ |
| 2058 | pathkeys = build_join_pathkeys(root, joinrel, jointype, |
| 2059 | outerpath->pathkeys); |
| 2060 | |
| 2061 | /* |
| 2062 | * Try the cheapest parameterized paths; only those which will produce |
| 2063 | * an unparameterized path when joined to this outerrel will survive |
| 2064 | * try_partial_nestloop_path. The cheapest unparameterized path is |
| 2065 | * also in this list. |
| 2066 | */ |
| 2067 | foreach(lc2, innerrel->cheapest_parameterized_paths) |
| 2068 | { |
| 2069 | Path *innerpath = (Path *) lfirst(lc2); |
| 2070 | Path *mpath; |
| 2071 | |
| 2072 | /* Can't join to an inner path that is not parallel-safe */ |
| 2073 | if (!innerpath->parallel_safe) |
| 2074 | continue; |
| 2075 | |
| 2076 | /* |
| 2077 | * If we're doing JOIN_UNIQUE_INNER, we can only use the inner's |
| 2078 | * cheapest_total_path, and we have to unique-ify it. (We might |
| 2079 | * be able to relax this to allow other safe, unparameterized |
| 2080 | * inner paths, but right now create_unique_path is not on board |
| 2081 | * with that.) |
| 2082 | */ |
| 2083 | if (save_jointype == JOIN_UNIQUE_INNER) |
| 2084 | { |
| 2085 | if (innerpath != innerrel->cheapest_total_path) |
| 2086 | continue; |
| 2087 | innerpath = (Path *) create_unique_path(root, innerrel, |
| 2088 | innerpath, |
| 2089 | extra->sjinfo); |
| 2090 | Assert(innerpath); |
| 2091 | } |
no test coverage detected