Re: [PATCH] Keeps tracking the uniqueness with UniqueKey

From: Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com>
To: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, rushabh(dot)lathia(at)gmail(dot)com, Ashutosh Bapat <ashutosh(dot)bapat(at)2ndquadrant(dot)com>
Subject: Re: [PATCH] Keeps tracking the uniqueness with UniqueKey
Date: 2020-04-17 01:16:59
Message-ID: CAKU4AWq5wbtNP7AFufPcSV68cx0ZLsN2TkLZx7A61LX-ZD9KCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Apr 16, 2020 at 8:36 PM Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
wrote:

> On Thu, Apr 16, 2020 at 7:47 AM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
>
> > (9 rows)
> >
> > With this feature:
> > explain analyze select a, sum(c) from grp2 group by a;
> > QUERY PLAN
> >
> --------------------------------------------------------------------------------------------------------------------------
> > GroupAggregate (cost=0.00..553031.57 rows=10000023 width=12) (actual
> time=0.044..13209.485 rows=10000000 loops=1)
> > Group Key: a
> > -> Seq Scan on grp2 (cost=0.00..403031.23 rows=10000023 width=8)
> (actual time=0.023..4938.171 rows=10000000 loops=1)
> > Planning Time: 0.400 ms
> > Execution Time: 13749.121 ms
> > (5 rows)
> >
>
> Applying the patch gives a white space warning
> git am /tmp/v6-000*
> Applying: Introduce UniqueKeys to determine RelOptInfo unique properties
> .git/rebase-apply/patch:545: indent with spaces.
> /* Fast path */
> warning: 1 line adds whitespace errors.
> Applying: Skip DISTINCT / GROUP BY if input is already unique
>
> Compiling the patch causes one warning
> nodeAgg.c:2134:3: warning: enumeration value ‘AGG_UNIQUE’ not handled
> in switch [-Wswitch]
>
>
Thanks, I will fix them together with some detailed review suggestion.
(I know the review need lots of time, so appreciated for it).

> I have not looked at the patch. The numbers above look good. The time
> spent in summing up a column in each row (we are summing only one
> number per group) is twice the time it took to read those rows from
> the table. That looks odd. But it may not be something unrelated to
> your patch. I also observed that for explain analyze select a from
> grp2 group by a; we just produce a plan containing seq scan node,
> which is a good thing.
>

Great and welcome back Ashutosh:)

> --
> Best Wishes,
> Ashutosh Bapat
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-04-17 01:26:40 Re: sqlsmith crash incremental sort
Previous Message James Coleman 2020-04-17 01:04:41 Re: [DOC] Document concurrent index builds waiting on each other