Re: Partial aggregates pushdown

From: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: "Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp" <Fujii(dot)Yuki(at)df(dot)mitsubishielectric(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephen Frost <sfrost(at)snowman(dot)net>, Andres Freund <andres(at)anarazel(dot)de>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, Daniel Gustafsson <daniel(at)yesql(dot)se>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: Partial aggregates pushdown
Date: 2024-06-05 05:19:04
Message-ID: a22d250b61a3faa425864573364db66d@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian писал(а) 2024-06-04 20:12:
> On Mon, May 27, 2024 at 09:30:59PM +0000,
> Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp wrote:
>> Hi Mr. Pyhalov.
>>
>> Sorry for the late reply.
>> Thank you for your modification and detailed review.
>> I attach a fixed patch, have been not yet rebased.
>
> I know this patch was discussed at the Vancouver conference. What are
> the open issues? I know of several:
>
> * add tests that were requested by Fujii-san and now posted by
> Alexander Pyhalov
> * Where is the documentation? I know the original patch had some, and
> I improved it, but it seems to be missing.
> * Passes unsafe binary data from the foreign server.
>
> Can someone show me where that last item is in the patch, and why can't
> we just pass back values cast to text?

Hi.

In finalize_aggregate() when we see partial aggregate with
peragg->aggref->aggtranstype = INTERNALOID
we call aggregate's serialization function and return it as bytea.

The issue is that this internal representation isn't guaranteed to be
compatible between servers
of different versions (or architectures?). So, likely, we instead should
have called some export function for aggregate
and later - some import function on postgres_fdw side. It doesn't matter
much, what this export function
generates - text, json or some portable binary format,
1) export/import functions should just "understand" it,
2) it should be a stable representation.
--
Best regards,
Alexander Pyhalov,
Postgres Professional

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2024-06-05 05:21:56 Re: Schema variables - new implementation for Postgres 15
Previous Message Michael Paquier 2024-06-05 05:15:20 Re: pg_parse_json() should not leak token copies on failure