Tom Lane wrote:
> I said:
>
>>A better alternative is to get the planner to notice in the context of
>>the outer query that the inner query's result is already sorted by
>>recnum. Then it wouldn't do the unwanted sort in any case. This has
>>been on the to-do list for awhile, but hasn't risen to the top ...
>
>
> Now it has ... as of CVS tip, you can do
[ Nice demo ... ]
> Note the lack of an extra sort above the subquery. This provides a
> general technique for controlling the ordering of inputs to a
> user-written aggregate function, even when grouping.
Schön ! I suppose that this has other fringe benefits for planning in
general ...
Thanks a lot ! I'll try to build a secondary PostgreSQL from CVS on a
development machine to test it.
Do you plan incorporation in some forthcoming 7.3.x ? Or push it back to 7.4 ?
Emmanuel Charpentier