pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: Wei Weng <wweng@kencast.com>
Cc: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Subject: Re: iceberg queries
Date: Tue, 4 Feb 2003 09:50:13 -0600
Message-ID: <20030204155013.GA4209@wolff.to> (raw)
In-Reply-To: <002101c2cc56$f5112330$2f437242@PASCAL>
References: <3E3F7C59.E6C5278C@rodos.fzk.de>
	<002101c2cc56$f5112330$2f437242@PASCAL>

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.



view thread (7+ messages)  latest in thread

Message-ID: <20030204155013.GA4209@wolff.to>
Permalink:  ../20030204155013.GA4209@wolff.to/
Also on:    postgresql.org/message-id/20030204155013.GA4209@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, wweng@kencast.com, ch@rodos.fzk.de
  Subject: Re: iceberg queries
  In-Reply-To: <20030204155013.GA4209@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox