Re: aggregate function for median calculation

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: aggregate function for median calculation
Дата
Msg-id 8180.992991226@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: aggregate function for median calculation  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: aggregate function for median calculation  ("Thalis A. Kalfigopoulos" <thalis@cs.pitt.edu>)
Список pgsql-general
Peter Eisentraut <peter_e@gmx.net> writes:
> Sure, you create a (static) global variable and reallocate memory for it
> in each call and free it by the finalizer function.

A static would be a bad idea (consider a query with multiple instances
of this aggregate being evaluated in parallel).

But there's no reason that the transition function can't palloc a larger
and larger chunk of memory for each result (as long as you don't run out
of memory, anyway).

            regards, tom lane

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

Предыдущее
От: "Thalis A. Kalfigopoulos"
Дата:
Сообщение: postgres.h missing?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: postgres.h missing?