Re: [PATCH] Erase the distinctClause if the result is unique by definition

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Julien Rouhaud <rjuju123(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: [PATCH] Erase the distinctClause if the result is unique by definition
Date: 2020-03-11 15:42:43
Message-ID: CAExHW5sY+L6iZ=rwnL7n3jET7aNLCNQimvfcS7C+5wmdjmdPiw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Mar 10, 2020 at 9:12 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
>
>
> Hi Tom & David & Bapat:
>
> Thanks for your review so far. I want to summarize the current issues to help
> our following discussion.
>
> 1. Shall we bypass the AggNode as well with the same logic.
>
> I think yes, since the rules to bypass a AggNode and UniqueNode is exactly same.
> The difficulty of bypassing AggNode is the current aggregation function call is closely
> coupled with AggNode. In the past few days, I have make the aggregation call can
> run without AggNode (at least I tested sum(without finalized fn), avg (with finalized fn)).
> But there are a few things to do, like acl check, anynull check and maybe more check.
> also there are some MemoryContext mess up need to fix.
> I still need some time for this goal, so I think the complex of it deserves another thread
> to discuss it, any thought?

I think if the relation underlying an Agg node is know to be unique
for given groupByClause, we could safely use AGG_SORTED strategy.
Though the input is not ordered, it's sorted thus for every row Agg
node will combine/finalize the aggregate result.

--
Best Wishes,
Ashutosh Bapat

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ashutosh Bapat 2020-03-11 15:47:20 Re: [PATCH] Erase the distinctClause if the result is unique by definition
Previous Message Peter Geoghegan 2020-03-11 15:41:56 Re: Improve search for missing parent downlinks in amcheck