wip: functions median and percentile

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема wip: functions median and percentile
Дата
Msg-id AANLkTimRksUOgGsK7-gTXnvJJGL-1QvuqxidusZQwep6@mail.gmail.com
обсуждение исходный текст
Ответы Re: wip: functions median and percentile  (Greg Stark <gsstark@mit.edu>)
Re: wip: functions median and percentile  (Hitoshi Harada <umi.tanuki@gmail.com>)
Список pgsql-hackers
Hello

I am sending a prototype implementation of functions median and
percentile. This implementation is very simple and I moved it to
contrib for this moment - it is more easy maintainable. Later I'll
move it to core.

These functions are relative simple, there are not barrier for
implementation own specific mutations of this functions - so I propose
move to core only basic and well known form of these to core.

postgres=# select median(v) from generate_series(1,10) g(v);
 median
────────
    5.5
(1 row)

Time: 1.475 ms
postgres=# select percentile(v,50) from generate_series(1,10) g(v);
 percentile
────────────
          5
(1 row)

Time: 0.626 ms

This implementation is based on tuplesort and the speed is relative
well - the result from 1000000 rows is less 1 sec.

Regards

Pavel Stehule

Вложения

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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: proposal: tuplestore, tuplesort aggregate functions
Следующее
От: Robert Haas
Дата:
Сообщение: Re: PL/pgsSQL EXECUTE USING INTO