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: "Finnerty, Jim" <jfinnert(at)amazon(dot)com>, 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>, "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-09-26 22:35:28
Message-ID: OS3PR01MB66608567A5DE381D99BEE1A395C3A@OS3PR01MB6660.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Mr.Momjian, Mr.Pyhalov.

Tuesday, 26 September 2023 22:15 Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>:
> Do you mean that extra->partial_target->sortgrouprefs is not replaced,
> and so we preserve tlesortgroupref numbers?
Yes, that is correct.

> I'm suspicious about rewriting extra->partial_target->exprs with
> partial_target->exprs - I'm still not sure why we
> don't we loose information, added by add_column_to_pathtarget() to
> extra->partial_target->exprs?
>
> Also look at the following example.
>
> EXPLAIN VERBOSE SELECT count(*) , (b/2)::numeric FROM pagg_tab GROUP BY
> b/2 ORDER BY 1;
> QUERY PLAN
> ---------------------------------------------------------------------------------------------------
> Sort (cost=511.35..511.47 rows=50 width=44)
> Output: (count(*)), ((((pagg_tab.b / 2)))::numeric), ((pagg_tab.b /
> 2))
> Sort Key: (count(*))
> -> Finalize HashAggregate (cost=509.06..509.94 rows=50 width=44)
> Output: count(*), (((pagg_tab.b / 2)))::numeric, ((pagg_tab.b /
> 2))
> Group Key: ((pagg_tab.b / 2))
> -> Append (cost=114.62..506.06 rows=600 width=16)
> -> Foreign Scan (cost=114.62..167.69 rows=200 width=16)
> Output: ((pagg_tab.b / 2)), (PARTIAL count(*)),
> pagg_tab.b
> Relations: Aggregate on (public.fpagg_tab_p1
> pagg_tab)
> Remote SQL: SELECT (b / 2), count(*), b FROM
> public.pagg_tab_p1 GROUP BY 1, 2
> -> Foreign Scan (cost=114.62..167.69 rows=200 width=16)
> Output: ((pagg_tab_1.b / 2)), (PARTIAL count(*)),
> pagg_tab_1.b
> Relations: Aggregate on (public.fpagg_tab_p2
> pagg_tab_1)
> Remote SQL: SELECT (b / 2), count(*), b FROM
> public.pagg_tab_p2 GROUP BY 1, 2
> -> Foreign Scan (cost=114.62..167.69 rows=200 width=16)
> Output: ((pagg_tab_2.b / 2)), (PARTIAL count(*)),
> pagg_tab_2.b
> Relations: Aggregate on (public.fpagg_tab_p3
> pagg_tab_2)
> Remote SQL: SELECT (b / 2), count(*), b FROM
> public.pagg_tab_p3 GROUP BY 1, 2
>
> Note that group by is still deparsed incorrectly.
Thank you for comments. You are right.
It is a mistake to rewrite extra->partial_target->exprs with partial_target->exprs.
I fixed this point.

September 26, 2023 (Fire) 23:16 Bruce Momjian <bruce(at)momjian(dot)us>.
> On Tue, Sep 26, 2023 at 06:26:25AM +0000, Fujii(dot)Yuki(at)df(dot)MitsubishiElectric(dot)co(dot)jp wrote:
> > Hi Mr.Bruce.
> > > I think this needs to be explained in the docs. I am ready to adjust the patch to improve the wording whenever you are
> > > ready. Should I do it now and post an updated version for you to use?
> > The following explanation was omitted from the documentation, so I added it.
> > > * false - no check
> > > * true, remove version < sender - check
> > I have responded to your comment, but if there is a problem with the wording, could you please suggest a correction?
>
> I like your new wording, thanks.
Thanks.

Sincerely yours,
Yuuki Fujii

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

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2023-09-26 22:54:25 Re: pg_upgrade instructions involving "rsync --size-only" might lead to standby corruption?
Previous Message Tom Lane 2023-09-26 22:23:18 Annoying build warnings from latest Apple toolchain