Re: Column as result of subtraction of two other columns?

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: Column as result of subtraction of two other columns?
Дата
Msg-id 288ki01a8oo4598h7effii1p6iqn244sq6@email.aon.at
обсуждение исходный текст
Ответ на Re: Column as result of subtraction of two other columns?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On Fri, 16 Jul 2004 12:04:54 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>    select sum(x), sum(y), sum(x)-sum(y) from ...
>
>At least since 7.4, the system will notice the duplicate aggregates
>and run only two summations to compute the above, followed by a single
>subtraction at the end.  The apparently more intelligent way suggested
>by Jean will have to run three summations, and thus end up being a net
>loss.

Also note that Jean-Luc's
    select sum( x), sum( y), sum(x-y) from whatever group by z;
gives a different result in the presence of NULLs.

Servus
 Manfred

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

Предыдущее
От: Stephan Szabo
Дата:
Сообщение: Re: Why does =ANY() need an extra cast when used
Следующее
От: "A Palmblad"
Дата:
Сообщение: Re: database troubles - various errors