Re: WIP Patch for GROUPING SETS phase 1

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Subject: Re: WIP Patch for GROUPING SETS phase 1
Date: 2014-09-09 15:25:07
Message-ID: CA+TgmoYnKMik3uBLibfFzNUBEyT-Ws-i5gzO5yBNzWpAARP85Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 9, 2014 at 11:19 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> 2014-09-09 16:01 GMT+02:00 Robert Haas <robertmhaas(at)gmail(dot)com>:
>> On Thu, Aug 21, 2014 at 11:01 AM, Andrew Gierth
>> <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>> >>>>>> "Heikki" == Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
>> > Heikki> Uh, that's ugly. The EXPLAIN out I mean; as an implementation
>> > Heikki> detail chaining the nodes might be reasonable. But the above
>> > Heikki> gets unreadable if you have more than a few grouping sets.
>> >
>> > It's good for highlighting performance issues in EXPLAIN, too.
>>
>> Perhaps so, but that doesn't take away from Heikki's point: it's still
>> ugly. I don't understand why the sorts can't all be nested under the
>> GroupAggregate nodes. We have a number of nodes already (e.g. Append)
>> that support an arbitrary number of children, and I don't see why we
>> can't do the same thing here.
>
> I don't think so showing sort and aggregation is bad idea. Both can have a
> different performance impacts

Sure, showing the sort and aggregation steps is fine. But I don't see
what advantage we get out of showing them like this:

Aggregate
-> Sort
-> ChainAggregate
-> Sort
-> ChainAggregate
-> Sort

When we could show them like this:

Aggregate
-> Sort
-> Sort
-> Sort

From both a display perspective and an implementation-complexity
perspective, it seems appealing to have the Aggregate node feed the
data to one sort after another, rather having it send the data down a
very deep pipe.

I might be missing something, of course. I don't want to presume that
I'm smarter than Andrew, because Andrew is pretty smart. :-) But it
seems odd to me.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2014-09-09 15:37:43 Re: proposal: plpgsql - Assert statement
Previous Message Pavel Stehule 2014-09-09 15:19:16 Re: WIP Patch for GROUPING SETS phase 1