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

From David Rowley
Subject Re: Expand applicability of aggregate's sortop optimization
Date
Msg-id CAApHDvptgyCG4o9DX5U91fq677E9p6WiYNs6H65sqWdy=9z5Fw@mail.gmail.com
Whole thread Raw
In response to Re: Expand applicability of aggregate's sortop optimization  (David Rowley <dgrowleyml@gmail.com>)
List pgsql-hackers
On Thu, 9 May 2024 at 13:08, David Rowley <dgrowleyml@gmail.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



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Support tid range scan in parallel?
Next
From: Paul Jungwirth
Date:
Subject: Re: PERIOD foreign key feature