Hi! I've applied your changes with minor editing, thank you.
On Thu, Jan 18, 2024 at 11:49 AM Andrei Lepikhov <a.lepik...@postgrespro.ru> wrote: > >> * Part of the work performed in this patch overlaps with that of > >> preprocess_groupclause. They are both trying to adjust the ordering of > >> the GROUP BY keys to match ORDER BY. I wonder if it would be better to > >> perform this work only once. > > > > Andrei, could you take a look. > As I see, the PathKeyInfo list often contains duplicated pathkeys, > coming from either sort_pathkeys or path->pathkeys orderings. So, I can > propose to check duplicates each time (see step2.txt in attachment). Actually I asked to recheck if we can cut some part of preprocess_groupclause() given that we're reordering the pathkeys later. It seems that we can remove everything except the work with a grouping set. I've done this in the revised patchset. I'm going to push this if there are no objections. ------ Regards, Alexander Korotkov
0002-Explore-alternative-orderings-of-group-by-p-20240119.patch
Description: Binary data
0001-Generalize-common-code-of-adding-sort-befor-20240119.patch
Description: Binary data