Re: Partial aggregates pushdown

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Tomas Vondra <tomas(at)vondra(dot)me>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Partial aggregates pushdown
Date: 2024-08-22 11:05:51
Message-ID: CAExHW5sQJ4SaPGkj_7NtLX2gjQ=Xnhb70-Y6dcnm2hDmf5=QWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 21, 2024 at 9:11 PM Tomas Vondra <tomas(at)vondra(dot)me> wrote:
>
>
>
> On 8/8/24 13:48, Jelte Fennema-Nio wrote:
> > SUMMARY OF THREAD
> >
> > The design of patch 0001 is agreed upon by everyone on the thread (so
> > far). This adds the PARTIAL_AGGREGATE label for aggregates, which will
> > cause the finalfunc not to run. It also starts using PARTIAL_AGGREGATE
> > for pushdown of aggregates in postgres_fdw. In 0001 PARTIAL_AGGREGATE
> > is only supported for aggregates with a non-internal/pseudo type as
> > the stype.
> >
>
> I don't have a strong opinion on this, but I wonder if someone might
> object this essentially extends the syntax with something that is not
> (and never will be) in the SQL standard. I wonder if there's some
> precedent for encoding such explicit execution instructions into the
> query itself?

This feature might be a useful feature to run aggregation in a
federated database across many source databases. So people in the
community who participate in SQL standard may add it there. While
implementing the feature, we might think of it as influencing the
execution but I don't see it that way. It's a feature allowing users
to access a pre-finalization state of an aggregate which they can use
to combine with such states from other data sources. There may be
other uses as well. But adding it as a SQL feature means some
standardization of what is partial aggregate for each aggregate
function - the notions of which are intuitive but they need to be
standardized. Of course, going this way means that it will take longer
for the feature to be available but it won't look like a kludge at
least.

--
Best Wishes,
Ashutosh Bapat

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jakub Wartak 2024-08-22 11:10:15 Re: Enable data checksums by default
Previous Message Thomas Munro 2024-08-22 10:32:41 Re: Segfault in jit tuple deforming on arm64 due to LLVM issue