On Mon, Oct 28, 2024 at 6:15 PM Andrei Lepikhov <lepi...@gmail.com> wrote: > On 6/7/24 16:46, Richard Guo wrote: > > This patch does not apply any more, so here is a new rebase, with some > > tweaks to the comments.
> This patch needs a minor rebase again. > After skimming the code, I want to say that it looks good. But maybe to > avoid one more *_reordering GUC - it would be better to cover all path > key reorderings under a single GUC. Thanks for reviewing this patch. After some consideration, I think it's not too complex to also apply this optimization to DISTINCT ON. The parser already ensures that the DISTINCT ON expressions match the initial ORDER BY expressions; we just need to ensure that the resulting pathkey list from the reordering matches the original distinctClause pathkeys, while leaving the remaining pathkeys unchanged in order. Please see attached. I'm not sure about merging these two 'reordering' GUCs into one. While they may look similar, they apply to very different scenarios. However, I'm open to other suggestions. Thanks Richard
v4-0001-Reordering-DISTINCT-keys-to-match-input-path-s-pathkeys.patch
Description: Binary data