| От | Tomasz Myrta |
|---|---|
| Тема | Re: order by and aggregate |
| Дата | |
| Msg-id | 3E19B60A.9080701@klaster.net обсуждение исходный текст |
| Ответ на | order by and aggregate (Tomasz Myrta <jasiek@klaster.net>) |
| Список | pgsql-sql |
Tom Lane wrote: > Tomasz Myrta writes: > > >Standard Postgresql aggregate functions don't need sorted data, but my > >function needs. Look at the data: > > > >3 3 > >-2 1 > >6 7 *** max_sum=7 > >-3 4 > >2 6 > > > But if the input data is sorted into increasing order, then the largest > running sum value is always at the end. Therefore max(sum()) is > equivalent to sum(); therefore you do not need the special aggregate, > nor the ordering. > > regards, tom lane Sorting data by "value" was only an example, In my case data is sorted by another key and has mixed positive and negative values. Tomasz Myrta
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера