Skip site navigation (1) Skip section navigation (2)

Re: OLAP, Aggregates, and order of operations

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mlw <markw(at)mohawksoft(dot)com>
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:19:05
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
mlw <markw(at)mohawksoft(dot)com> writes:
>> 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?

I was thinking something like

    select my_aggregate(my_array_constructor(foo, bar, baz)) from ...

where my_array_constructor is a quick hack C routine to build a
3-element array from 3 input arguments (s/3/whatever you need/).
Someday we ought to have SQL syntax to build an array value from
a list of scalars, but in the meantime an auxiliary function is the
only way to do it.

The overhead of constructing and then interpreting the temporary
array value is slightly annoying, but I don't think it'll be horribly
expensive.  See the existing aggregate-related routines in numeric.c
if you need some help with the C coding.

			regards, tom lane

In response to


pgsql-hackers by date

Next:From: Rene PijlmanDate: 2001-08-23 19:33:35
Subject: Re: Toast, Text, blob bytea Huh?
Previous:From: mlwDate: 2001-08-23 19:11:04
Subject: Re: OLAP, Aggregates, and order of operations

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group