Re: Relational Algebra and Aggregate Functions
От | Robert James |
---|---|
Тема | Re: Relational Algebra and Aggregate Functions |
Дата | |
Msg-id | e09785e00907280614g42bb5257w7e8f0a9e9513fc15@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Relational Algebra and Aggregate Functions (Sam Mason <sam@samason.me.uk>) |
Ответы |
Re: Relational Algebra and Aggregate Functions
|
Список | pgsql-general |
Many wrote that the functional programming 'fold' is a good model for relational aggregate functions. I have a few difficulties with this:
1. fold doesn't offer any type of GROUP BY, which is an essential component of aggregation.
2. I don't believe fold can handle things like AVG() or STDDEV(). Can it? Conversely, fold can handle non-commutative and non-associative operators, which I don't believe can be used for aggregation.
3. fold is defined on sequences, not sets. This doesn't seem to be a problem until you think about cases where there a duplicates of the aggregated field. (For instance, there are 10 bags each weighing 5 lbs, and you want SUM(weight) - you need to project weight onto a collection which allows for 10 occurences, or define the aggregate function to work on the whole tuple somehow... I know a man named Krug worked out a formal theory for this...)
В списке pgsql-general по дате отправления: