diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 342f5ad8d0..acc324122f 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -4819,7 +4819,7 @@ create_partial_distinct_paths(PlannerInfo *root, RelOptInfo *input_rel, if (partial_distinct_rel->partial_pathlist != NIL) { - generate_gather_paths(root, partial_distinct_rel, true); + generate_useful_gather_paths(root, partial_distinct_rel, true); set_cheapest(partial_distinct_rel); /* diff --git a/src/test/regress/expected/select_distinct.out b/src/test/regress/expected/select_distinct.out index 1f72756ccb..82b8e54f5f 100644 --- a/src/test/regress/expected/select_distinct.out +++ b/src/test/regress/expected/select_distinct.out @@ -235,10 +235,10 @@ SELECT DISTINCT four FROM tenk1; QUERY PLAN ---------------------------------------------------- Unique - -> Sort - Sort Key: four - -> Gather - Workers Planned: 2 + -> Gather Merge + Workers Planned: 2 + -> Sort + Sort Key: four -> HashAggregate Group Key: four -> Parallel Seq Scan on tenk1