Re: iceberg queries - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: iceberg queries
Date
Msg-id 20030204155013.GA4209@wolff.to
Whole thread Raw
In response to Re: iceberg queries  ("Wei Weng" <wweng@kencast.com>)
List pgsql-sql
On Tue, Feb 04, 2003 at 09:08:56 -0500, Wei Weng <wweng@kencast.com> wrote:
> It is a query that looks like
> 
> SELECT target1, target2... targetn, SUN(t.qty)
> FROM Table t
> GROUP BY target1
> HAVING SUM(t.qty)>=10
> 
> You can replace SUM(t.qty)>=10 with other aggregate constraints.

There were some recent changes to allow groups to use hashes that may
help for queries like this. This can save a sort step or using an
index scan.

In theory you might be able to make some other speed ups by taking advantage
of properties of specific aggregate functions (in particular that several
common ones monotonicly increase or decrease as they are being calculated)
and if doing an index scan on the fields used for group you might be able to
skip a lot of rows. I expect that this situation would come up pretty rarely
though.


pgsql-sql by date:

Previous
From: "Wei Weng"
Date:
Subject: Re: iceberg queries
Next
From: Jan Wieck
Date:
Subject: Re: pg_views