Re: Expand applicability of aggregate's sortop optimization - Mailing list pgsql-hackers

From Andrei Lepikhov
Subject Re: Expand applicability of aggregate's sortop optimization
Date
Msg-id bc8d12f2-b0cc-45ef-a142-46cb6a52f653@gmail.com
Whole thread Raw
In response to Re: Expand applicability of aggregate's sortop optimization  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Expand applicability of aggregate's sortop optimization
List pgsql-hackers
On 5/9/24 08:08, David Rowley wrote:
> On Thu, 9 May 2024 at 12:26, David Rowley <dgrowleyml@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




pgsql-hackers by date:

Previous
From: Peter Smith
Date:
Subject: Re: Slow catchup of 2PC (twophase) transactions on replica in LR
Next
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Slow catchup of 2PC (twophase) transactions on replica in LR