Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> Incidentally, the most obvious obstacle to better planning of grouping
> sets in the sorted cases is not so much how to pick paths in
> grouping_planner itself, but rather the fact that query_planner wants to
> be given only one sort order. Is there any prospect for improvement
> there?
Hm. That's a hangover from when query_planner also gave back a Plan
(singular) rather than a set of Paths. I don't see any fundamental reason
why we couldn't generalize it to be a list of potentially useful output
orderings rather than just one. But I'm a bit concerned about the ensuing
growth in planning time; is it really all that useful?
regards, tom lane