Re: wip: functions median and percentile

Поиск
Список
Период
Сортировка
От Hitoshi Harada
Тема Re: wip: functions median and percentile
Дата
Msg-id AANLkTikaVTKJ1rpcEbWNUcYiZBJ7Q-qph-XNit4vE2wf@mail.gmail.com
обсуждение исходный текст
Ответ на Re: wip: functions median and percentile  (Greg Stark <gsstark@mit.edu>)
Ответы Re: wip: functions median and percentile  (Dean Rasheed <dean.a.rasheed@gmail.com>)
Список pgsql-hackers
2010/10/4 Greg Stark <gsstark@mit.edu>:
> On Sun, Oct 3, 2010 at 7:06 AM, Hitoshi Harada <umi.tanuki@gmail.com> wrote:
>> And I'm now thinking about how to make median happen in window
>> aggregate.
>
> If you were to do this by extending tuplesort what extra features
> would tuplesort need?

I don't think we need to extend tuplesort when we do it. IMO this can
make happen by fetching all the values in the frame and performing
sort once, then getting current position and calculate median. The
only thing I consider is to mark and to go to the demanded position in
tuplesort like tuplestore, but actually we can manage to median()
without such facilities.

> How do existing windowed aggregates work if you specify an order by on
> the aggregate? Do they resort for every output row?

I don't know the true specification of median() nor the behavior of it
in other RDBs, but I bet median is median and ORDER BY in window
clause doesn't affect its result. ORDER BY specifies only the frame
boundary.

Regards,



-- 
Hitoshi Harada


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: patch: tsearch - some memory diet
Следующее
От: Markus Wanner
Дата:
Сообщение: Re: is sync rep stalled?