pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jan Wieck <JanWieck@Yahoo.com>
Cc: Christoph Haller <ch@rodos.fzk.de>
Cc: pgsql-sql@postgresql.org
Cc: wweng@kencast.com
Subject: Re: iceberg queries
Date: Tue, 04 Feb 2003 13:37:09 -0500
Message-ID: <15716.1044383829@sss.pgh.pa.us> (raw)
In-Reply-To: <3E40011C.94F11C92@Yahoo.com>
References: <3E3F7C59.E6C5278C@rodos.fzk.de>
	<3E40011C.94F11C92@Yahoo.com>

Jan Wieck <JanWieck@Yahoo.com> writes:
> As to the original question, if an index is available that returns the
> rows in the sort order of the GROUP BY clause, PostgreSQL defaults to an
> index scan, otherwise it will do a sort of the rows matching an optional
> WHERE clause. This sorted set is then grouped and aggregated and
> filtered by the HAVING clause after aggregation.

Note that as of 7.4, the planner will probably pick hashed aggregation
rather than sort-based aggregation, if it can predict that the number
of groups will not be too large for a hash table to fit in memory.
This means we can do a seqscan (or, perhaps, an indexscan to match
WHERE conditions) and avoid sorting.  So I expect performance on this
type of query to be a good deal better in 7.4.  There are a few
benchmark comparisons in the pghackers archives a couple months back.

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <15716.1044383829@sss.pgh.pa.us>
Permalink:  ../15716.1044383829@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15716.1044383829@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, JanWieck@Yahoo.com, ch@rodos.fzk.de, wweng@kencast.com
  Subject: Re: iceberg queries
  In-Reply-To: <15716.1044383829@sss.pgh.pa.us>

* 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