Re: OLAP, Aggregates, and order of operations

From: mlw <markw(at)mohawksoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: OLAP, Aggregates, and order of operations
Date: 2001-08-23 19:11:04
Message-ID: 3B855548.E03F436D@mohawksoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

> mlw <markw(at)mohawksoft(dot)com> writes:
> > I need to do some OLAP stuff, and I asked previously if there were a way
> > to pass multiple parameters to an aggrigate function. i.e.:
> > I looked through the code and it is non-trivial to do,
>
> Offhand I don't know of any fundamental reason why it couldn't be done,
> but you're right that it'd take a fair amount of work.

I understand the implications of the work, but it would be VERY cool to be
able to do this for statistical stuff.

>
> > If I do this:
> > select mycube(value1) as d1, dimention(value2) as d2, dimention(value3)
> > as d3 group by value1;
> > Can I safely assume the following:
> > (1) mycube() will be called first
> > (2) Assuming dimention() has no final func, that final func of mycube()
> > will be called last.
>
> That might be true in the present code, but it strikes me as an awfully
> risky set of assumptions. Also, it sounds like what you have in mind is
> to have some hidden state that all the aggregate functions will access;
> how then will you work if there are more than one set of these
> aggregates being used in a query?

What I was thinking is that I could use the state to hold a pointer returned
by palloc. I don't think I can handle multiple mycube() calls, but short of
reworking aggregates, I don't see any other way.

>
> If the needed parameters are all the same datatype, maybe you could put
> them into an array and pass the array as a single argument to the
> aggregate.

How would you do this without having to make multiple SQL calls?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2001-08-23 19:19:05 Re: OLAP, Aggregates, and order of operations
Previous Message Peter Eisentraut 2001-08-23 19:00:46 Re: A couple items on TODO