proposal: tuplestore, tuplesort aggregate functions

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема proposal: tuplestore, tuplesort aggregate functions
Дата
Msg-id AANLkTik63xkHRgmr45zPDk755Z=qFMhXusPvtxeoJ2Zt@mail.gmail.com
обсуждение исходный текст
Ответы Re: proposal: tuplestore, tuplesort aggregate functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hello

I still thinking about a "median" type functions. My idea is to
introduce a new syntax for stype definition - like

stype = type, or
stype = ARRAY OF type [ ORDER [ DESC | ASC ]], or
stype = TUPLESTORE OF type, or
stype = TUPLESORT OF type [ DESC | ASC ]

when stype is ARRAY of then final and transistent functions can be a
PL functions. When stype isn't scalar, then sfunc can be undefined (it
use a buildin functions). Then we can implement a aggregate only with
final functions.

so median function can be defined:

CREATE FUNCTION num_median_final(internal) RETURNS numeric AS ...
CREATE AGGREGATE median(numeric) (stype = TUPLESORT OF numeric,
finalfunc = num_median_final);

This feature has impact primary on agg executor, and can be relative
simple - no planner changes (or not big), minimal parser changes.

Main reason for this feature is possible access to tuplesort and
tuplesort. I hope, so this can solve a problems with computing a
median and similar functions on very large datasets.

comments?

regards


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: security label support, part.2
Следующее
От: Greg Stark
Дата:
Сообщение: Re: Progress indication prototype