Re: WITHIN GROUP patch

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: WITHIN GROUP patch
Дата
Msg-id 26331.1386194487@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: WITHIN GROUP patch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Ответы Re: WITHIN GROUP patch
Список pgsql-hackers
Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
>  Tom> But anyway, what I'm thinking right now is that these questions
>  Tom> would all go away if the aggregate transfunction were receiving
>  Tom> the rows and sticking them into the tuplestore.  It could add
>  Tom> whatever columns it felt like.

> True, but this ends up duplicating the sorting functionality of
> nodeAgg that we are leveraging off in the first place. I think this
> will be somewhat more intrusive and likely slower.

Hm, it's just a refactoring of the same code we'd have to have anyway,
so I'm not seeing a reason to assume it'd be slower.  If anything,
this approach would open more opportunities for function-specific
optimizations, which in the long run could be faster.  (I'm not
claiming that any such optimizations would be in the first version.)

In hindsight I wonder if it wasn't a mistake to embed ordered-aggregate
support in nodeAgg.c the way we did.  We could have dumped that
responsibility into some sort of wrapper around specific aggregates,
with an option for some aggregates to skip the wrapper and handle it
themselves.  A trivial, and perhaps not very useful, example is that
non-order-sensitive aggregates like MIN/MAX/COUNT could have been coded
to simply ignore any ordering request.  I can't immediately think of any
examples that are compelling enough to justify such a refactoring now ---
unless it turns out to make WITHIN GROUP easier.

Anyway, I'm going to go off and look at the WITHIN GROUP patch with these
ideas in mind.
        regards, tom lane



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Performance optimization of btree binary search
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Extension Templates S03E11