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 03:28:45
Message-ID: CAApHDvptgyCG4o9DX5U91fq677E9p6WiYNs6H65sqWdy=9z5Fw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 9 May 2024 at 13:08, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> 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.

Another argument for using this method is that
SupportRequestOptimizeAggref could allow future unrelated
optimisations such as swapping count(<non-nullable-col>) for count(*).
Where <non-nullable-col> is a NOT NULL column and isn't nullable by
any outer join. Doing that could speed some queries up quite a bit as
it may mean fewer columns to deform from the tuple. You could imagine
a fact table with many columns and a few dimensions, often the
dimension columns that you'd expect to use in GROUP BY would appear
before the columns you'd aggregate on.

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-05-09 03:46:36 pgsql: Fix overread in JSON parsing errors for incomplete byte sequence
Previous Message David Rowley 2024-05-09 03:16:30 Re: Support tid range scan in parallel?