Alexander Korotkov <aekorot...@gmail.com> writes: > On Wed, Dec 27, 2023 at 5:23 AM Tom Lane <t...@sss.pgh.pa.us> wrote: >> I think it's a fool's errand to even try to separate different sort >> column orderings by cost.
> Besides sorting column orderings by cost, this patch also tries to > match GROUP BY pathkeys to input pathkeys and ORDER BY pathkeys. Do > you think there is a chance for the second part if we leave the cost > part aside? I think it's definitely reasonable to try to match up available orderings, because that doesn't really require fine distinctions of cost: either it matches or it doesn't. Eliminating a sort step entirely is clearly a win. (Incremental sort complicates this though. I doubt our cost model for incremental sorts is any good either, so I am not eager to rely on that more heavily.) regards, tom lane