Hi Mr.Momjian, Mr.Pyhalov.
Tuesday, 26 September 2023 22:15 Alexander Pyhalov <a.pyhalov@postgrespro.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@momjian.us>.
> On Tue, Sep 26, 2023 at 06:26:25AM +0000, Fujii.Yuki@df.MitsubishiElectric.co.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
youare
> > > 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