Re: Expand applicability of aggregate's sortop optimization

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: 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-05-09 01:08:05
Message-ID: CAApHDvqiqBWCf8E5+KeViH-_p3oNC-5EkYGH7-L3f5w5PPR_pQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2024-05-09 02:14:59 Re: Slow catchup of 2PC (twophase) transactions on replica in LR
Previous Message Kirk Wolak 2024-05-09 01:07:57 Re: Idea Feedback: psql \h misses -> Offers Links?