Re: Final Patch for GROUPING SETS

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Andres Freund <andres(at)2ndquadrant(dot)com>, Greg Sabino Mullane <greg(at)turnstep(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tomas Vondra <tv(at)fuzzy(dot)cz>, Atri Sharma <atri(dot)jiit(at)gmail(dot)com>
Subject: Re: Final Patch for GROUPING SETS
Date: 2014-12-22 16:19:57
Message-ID: 8761d3is6c.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Tom" == Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

[Noah]
>> I caution against using window function performance as the
>> template for GROUPING SETS performance goals. The benefit of
>> GROUPING SETS compared to its UNION ALL functional equivalent is
>> 15% syntactic pleasantness, 85% performance opportunities.
>> Contrast that having window functions is great even with naive
>> performance, because they enable tasks that are otherwise too hard
>> in SQL.

Yes, this is a reasonable point.

Tom> The other reason that's a bad comparison is that I've not seen
Tom> many queries that use more than a couple of window frames,
Tom> whereas we have to expect that the number of grouping sets in
Tom> typical queries will be significantly more than "a couple".

I would be interested in seeing more good examples of the size and
type of grouping sets used in typical queries.

Tom> So we do have to think about what the performance will be like
Tom> with a lot of sort steps. I'm also worried that this use-case
Tom> may finally force us to do something about the "one work_mem per
Tom> sort node" behavior, unless we can hack things so that only one
Tom> or two sorts reach max memory consumption concurrently.

Modifying ChainAggregate so that only two sorts reach max memory
consumption concurrently seems to have been quite simple to implement,
though I'm still testing some aspects of it.

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2014-12-22 16:47:37 Re: pgbench -f and vacuum
Previous Message Andres Freund 2014-12-22 16:05:49 Re: Proposal "VACUUM SCHEMA"