Re: Expand applicability of aggregate's sortop optimization

From: Andrei Lepikhov <lepihov(at)gmail(dot)com>
To: David Rowley <dgrowleyml(at)gmail(dot)com>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Expand applicability of aggregate's sortop optimization
Date: 2024-07-17 05:12:04
Message-ID: bc8d12f2-b0cc-45ef-a142-46cb6a52f653@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 5/9/24 08:08, David Rowley wrote:
> On Thu, 9 May 2024 at 12:26, David Rowley <dgrowleyml(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hayato Kuroda (Fujitsu) 2024-07-17 05:13:35 RE: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Peter Smith 2024-07-17 04:28:20 Re: Slow catchup of 2PC (twophase) transactions on replica in LR