Re: Combining Aggregates

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: Combining Aggregates
Дата
Msg-id 54E7948D.9010803@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Combining Aggregates  (Peter Eisentraut <peter_e@gmx.net>)
Ответы Re: Combining Aggregates  (Peter Eisentraut <peter_e@gmx.net>)
Re: Combining Aggregates  (Peter Eisentraut <peter_e@gmx.net>)
Список pgsql-hackers
On 20.2.2015 21:01, Peter Eisentraut wrote:
> Is there a case where the combining function is different from the
> transition function, other than for count?

It's different in all the cases when the aggregate state is not
identical to a single value - for example the usual avg(), sum() and
stddev() aggregates keep state which is equal to
  {count(X), sum(X), sum(X*X)}

The 'combine' function gets two such 'state' values, while transition
gets 'state' + next value.

I'm inclined to say that 'combinefn == transfn' is a minority case.

-- 
Tomas Vondra                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: Combining Aggregates
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Precedence of standard comparison operators