Re: aggregates of aggregates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tor Roberts <pg(at)econsci(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: aggregates of aggregates
Date: 2000-08-28 04:02:04
Message-ID: 7162.967435324@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tor Roberts <pg(at)econsci(dot)net> writes:
> Does anyone know of any plans to support aggregates of aggregates in the
> future?

Not directly: it makes no sense in the SQL semantic model. We do have
plans to support subselect-in-FROM (hopefully in 7.2), which would allow
constructs like

SELECT count(*) FROM (SELECT foo,count(*) FROM bar GROUP BY foo)

The same revisions will also be needed before views that involve
grouping or aggregates will work right in all but the simplest cases.

> My solution was to put the result of the first aggregate function in a
> temp table, then doing the other select statement on the temp table. This
> is not very efficient as the temp table can have up to a million records
> in it.

Sounds like a good workaround for now.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-08-28 04:17:21 Re: bits & the end of the world
Previous Message Louis Bertrand 2000-08-28 03:46:29 book publishing date?