From: | Bruno Wolff III <bruno(at)wolff(dot)to> |
---|---|
To: | Wei Weng <wweng(at)kencast(dot)com> |
Cc: | Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: iceberg queries |
Date: | 2003-02-04 15:50:13 |
Message-ID: | 20030204155013.GA4209@wolff.to |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Tue, Feb 04, 2003 at 09:08:56 -0500,
Wei Weng <wweng(at)kencast(dot)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.
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2003-02-04 17:36:03 | Re: pg_views |
Previous Message | Wei Weng | 2003-02-04 14:08:56 | Re: iceberg queries |