Tom Lane wrote on 24.08.2006 20:47:
Perhaps an extremely smart optimizer could improve this using knowledge of the specific aggregates' behaviors, but for "black box" aggregates it sounds pretty unworkable.
I don't know how they do it, but those functions in Oracle are pretty fast. Usually ways faster than some equivalent combinations of self joins, outer joins and such.
Thomas