RE: Partial aggregates pushdown

From: "Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp" <Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp>
To: Bruce Momjian <bruce(at)momjian(dot)us>, Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, Ilya Gladyshev <i(dot)gladyshev(at)postgrespro(dot)ru>, "Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp" <Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp>
Subject: RE: Partial aggregates pushdown
Date: 2023-07-10 07:35:27
Message-ID: OS3PR01MB6660DF84634EDAFC55D7B0009530A@OS3PR01MB6660.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Mr.Bruce, Mr.Pyhalov, hackers.

> From: Bruce Momjian <bruce(at)momjian(dot)us>
> Sent: Monday, June 12, 2023 10:38 PM
>
> On Mon, Jun 12, 2023 at 08:51:30AM +0000, Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp wrote:
> > Hi Mr.Bruce, Mr.Pyhalov, hackers.
> >
> > Thank you for comments. I will try to respond to both of your comments as follows.
> > I plan to start revising the patch next week. If you have any comments
> > on the following respondences, I would appreciate it if you could give them to me this week.
> >
> > > From: Bruce Momjian <bruce(at)momjian(dot)us>
> > > Sent: Saturday, June 10, 2023 1:44 AM I agree that this feature is
> > > designed for built-in sharding, but it is possible people could be
> > > using aggregates on partitions backed by foreign tables without
> > > sharding. Adding a requirement for non-sharding setups to need PG 17+ servers might be unreasonable.
> > Indeed, it is possible to use partial aggregate pushdown feature for purposes other than sharding.
> > The description of the section "F.38.6. Built-in sharding in
> > PostgreSQL" assumes the use of Built-in sharding and will be modified to eliminate this assumption.
> > The title of this section should be changed to something like "Aggregate on partitioned table".
>
> Sounds good.
I have modified documents according to the above policy.

> From: Bruce Momjian <bruce(at)momjian(dot)us>
> Sent: Thursday, June 22, 2023 8:39 PM
> On Thu, Jun 22, 2023 at 05:23:33AM +0000, Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp wrote:
> > Approach1-3:
> > I will add a postgres_fdw option "check_partial_aggregate_support".
> > This option is false, default.
> > Only if this option is true, postgres_fdw connect to the remote server and get the version of the remote server.
> > And if the version of the remote server is less than PG17, then partial aggregate push down to the remote server is
> disable.
>
> Great!
I have modified the program except for the point "if the version of the remote server is less than PG17".
Instead, we have addressed the following.
"If check_partial_aggregate_support is true and the remote server version is older than the local server
version, postgres_fdw does not assume that the partial aggregate function is on the remote server unless
the partial aggregate function and the aggregate function match."
The reason for this is to maintain compatibility with any aggregate function that does not support partial
aggregate in one version of V1 (V1 is PG17 or higher), even if the next version supports partial aggregate.
For example, string_agg does not support partial aggregation in PG15, but it will support partial aggregation
in PG16.

We have not been able to add a test for the case where the remote server version is older than the
local server version to the regression test. Is there any way to add such tests to the existing regression
tests?

Sincerely yours,
Yuuki Fujii

--
Yuuki Fujii
Information Technology R&D Center Mitsubishi Electric Corporation

Attachment Content-Type Size
0001-Partial-aggregates-push-down-v23.patch application/octet-stream 249.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2023-07-10 07:44:27 Re: Show various offset arrays for heap WAL records
Previous Message Pavel Stehule 2023-07-10 07:23:58 Re: Schema variables - new implementation for Postgres 15