File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/backend/optimizer/path Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -698,18 +698,25 @@ get_cheapest_fractional_path_for_pathkeys(List *paths,
698698Path *
699699get_cheapest_parallel_safe_total_inner (List * paths )
700700{
701+ Path * matched_path = NULL ;
701702 ListCell * l ;
702703
703704 foreach (l , paths )
704705 {
705706 Path * innerpath = (Path * ) lfirst (l );
706707
707- if (innerpath -> parallel_safe &&
708- bms_is_empty (PATH_REQ_OUTER (innerpath )))
709- return innerpath ;
708+ if (!innerpath -> parallel_safe ||
709+ !bms_is_empty (PATH_REQ_OUTER (innerpath )))
710+ continue ;
711+
712+ if (matched_path != NULL &&
713+ compare_path_costs (matched_path , innerpath , TOTAL_COST ) <= 0 )
714+ continue ;
715+
716+ matched_path = innerpath ;
710717 }
711718
712- return NULL ;
719+ return matched_path ;
713720}
714721
715722/****************************************************************************
You can’t perform that action at this time.
0 commit comments