On 5/9/24 08:08, David Rowley wrote:
On Thu, 9 May 2024 at 12:26, David Rowley <dgrowle...@gmail.com> wrote:
I wonder if we should also consider as an alternative to this to just
have an aggregate support function, similar to
SupportRequestOptimizeWindowClause that just nullifies the aggorder /
aggdistinct fields for Min/Max aggregates on types where there's no
possible difference in output when calling the transition function on
rows in a different order.

Would that apply in enough cases for you?

One additional thought is that the above method would also help
eliminate redundant sorting in queries with a GROUP BY clause.
Whereas, the can_minmax_aggs optimisation is not applied in that case.
I generally like the idea of a support function. But as I can see, the can_minmax_aggs() rejects if any of the aggregates don't pass the checks. The prosupport feature is designed to be applied to each function separately. How do you think to avoid it? Also, I don't clearly understand the case you mentioned here - does it mean that you want to nullify orders for other aggregate types if they are the same as the incoming order?

--
regards, Andrei Lepikhov



Reply via email to