Re: Final Patch for GROUPING SETS

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Final Patch for GROUPING SETS
Дата
Msg-id 19548.1419263176@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Final Patch for GROUPING SETS  (Noah Misch <noah@leadboat.com>)
Ответы Re: Final Patch for GROUPING SETS  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: Final Patch for GROUPING SETS  (Noah Misch <noah@leadboat.com>)
Список pgsql-hackers
Noah Misch <noah@leadboat.com> writes:
> On Sat, Dec 13, 2014 at 04:37:48AM +0000, Andrew Gierth wrote:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>> Tom> That seems pretty grotty from a performance+memory consumption
>> Tom> standpoint.  At peak memory usage, each one of the Sort nodes
>> Tom> will contain every input row,

>> Has this objection ever been raised for WindowAgg, which has the same
>> issue?

> 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.

The other reason that's a bad comparison is that I've not seen many
queries that use more than a couple of window frames, whereas we have
to expect that the number of grouping sets in typical queries will be
significantly more than "a couple".  So we do have to think about what
the performance will be like with a lot of sort steps.  I'm also worried
that this use-case may finally force us to do something about the "one
work_mem per sort node" behavior, unless we can hack things so that only
one or two sorts reach max memory consumption concurrently.

I still find the ChainAggregate approach too ugly at a system structural
level to accept, regardless of Noah's argument about number of I/O cycles
consumed.  We'll be paying for that in complexity and bugs into the
indefinite future, and I wonder if it isn't going to foreclose some other
"performance opportunities" as well.
        regards, tom lane



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Moving src/backend/utils/misc/rbtree.c to src/backend/lib
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: btree_gin and ranges