Re: GROUPING SETS revisited

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Joshua Tolley <eggyknap(at)gmail(dot)com>
Cc: David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)postgresql(dot)org, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Subject: Re: GROUPING SETS revisited
Date: 2010-08-05 15:29:29
Message-ID: AANLkTimKAmhhULrHXHb87UEnadpn=Wz59__CLVzYWtCe@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I found other issue :(

postgres=# select name, place from cars group by grouping sets(name, place,());
name | place
-------+------------
bmw |
skoda |
opel |
| germany
| czech rep.
skoda | czech rep.
skoda | germany
bmw | czech rep.
bmw | germany
opel | czech rep.
opel | germany
(11 rows)

postgres=# explain select name, place from cars group by grouping
sets(name, place,());
QUERY PLAN
------------------------------------------------------------------------------
Append (cost=36.98..88.55 rows=1230 width=54)
CTE GroupingSets
-> Seq Scan on cars (cost=0.00..18.30 rows=830 width=68)
-> HashAggregate (cost=18.68..20.68 rows=200 width=32)
-> CTE Scan on "GroupingSets" (cost=0.00..16.60 rows=830 width=32)
-> HashAggregate (cost=18.68..20.68 rows=200 width=32)
-> CTE Scan on "GroupingSets" (cost=0.00..16.60 rows=830 width=32)
-> CTE Scan on "GroupingSets" (cost=0.00..16.60 rows=830 width=64)
(8 rows)

the combination of nonagregates and empty sets do a problems - because
we can't ensure agg mode without aggregates or group by. But it is
only minor issue

2010/8/5 Joshua Tolley <eggyknap(at)gmail(dot)com>:
> On Thu, Aug 05, 2010 at 04:46:51PM +0200, Pavel Stehule wrote:
>> So Joshua, can you look on code?
>
> Sure... thanks :)
>
> --
> Joshua Tolley / eggyknap
> End Point Corporation
> http://www.endpoint.com
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
>
> iEYEARECAAYFAkxa1NsACgkQRiRfCGf1UMPwzQCgjz52P86Yx4ac4aRkKwjn8OHK
> 6/EAoJ/CjXEyPaLpx39SI5bKQPz+AwBR
> =Mi2J
> -----END PGP SIGNATURE-----
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2010-08-05 15:31:10 Re: string_agg delimiter having no effect with order by
Previous Message Tom Lane 2010-08-05 15:25:37 Re: string_agg delimiter having no effect with order by