On Wed, Aug 21, 2024 at 9:11 PM Tomas Vondra <to...@vondra.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