Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitaf7d270

Browse files
committed
Fix hypothetical problem passing the wrong GROUP BY pathkeys
1349d27 changed things to make the planner request that thequery_pathkeys contain pathkeys for any ORDER BY / DISTINCT aggregates.Some code added prior to that commit indb0d67d made it so the orderthat the pathkeys appear in the group_pathkeys could be changed so thatthe GROUP BY could be executed in a more optimal order which minimizedsort comparisons.1349d27 had to make sure that the pathkeys for anyORDER BY / DISTINCT aggregates remained at the end of the groupby_pathkeysand wasn't reordered, so some code was added toadd_paths_to_grouping_rel() to first strip off any pathkeys belonging toORDER BY / DISTINCT aggregates before passing to the function to optimizethe order of the group_pathkeys.It seems I dropped the ball in1349d27 and mistakenly used the untouchedPlannerInfo.group_pathkeys to pass to get_useful_group_keys_orderings()instead of the version that had the aggregate pathkeys removed. It wasonly the code path that was handling creating paths forpartially_grouped_rel which made this mistake. In practice, we'll neverhave any extra pathkeys to strip off when processingpartially_grouped_rel as that's only used when considering partialpaths, which we never do when there are ORDER BY / DISTINCT aggregates.So this is just a hypothetical bug, not a live bug. We already have thecorrect pathkeys determined, so it's of no extra cost to pass thecorrect variable.Reported-by: Justin PryzbyDiscussion:https://postgr.es/m/20220817015755.GB26426@telsasoft.com
1 parenta340359 commitaf7d270

File tree

1 file changed

+0
-3
lines changed

1 file changed

+0
-3
lines changed

‎src/backend/optimizer/plan/planner.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6637,10 +6637,7 @@ add_paths_to_grouping_rel(PlannerInfo *root, RelOptInfo *input_rel,
66376637
ListCell*lc2;
66386638
Path*path= (Path*)lfirst(lc);
66396639
Path*path_original=path;
6640-
66416640
List*pathkey_orderings=NIL;
6642-
6643-
List*group_pathkeys=root->group_pathkeys;
66446641
List*group_clauses=parse->groupClause;
66456642

66466643
/* generate alternative group orderings that might be useful */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp