From: Josh Berkus <josh@agliodbs.com>
To: Shawn Chisholm <schisholm@sandvine.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance tradeoff
Date: Wed, 2 Mar 2005 21:31:01 -0800
Message-ID: <200503022131.01658.josh@agliodbs.com> (raw)
In-Reply-To: <71837C040963F748B9B94E123A28967805710B@mailserver.sandvine.com>
References: <71837C040963F748B9B94E123A28967805710B@mailserver.sandvine.com>
Shawn,
> I can also change the schema to a certain extent, so would it be worthwhile
> to put indices on the queried tables (or refactor them) hoping the distinct
> does an index scan instead of sort... would the query planner take
> advantage of that?
Use the GROUP BY, with an index on the grouped columns and lots of work_mem
(sort_mem in 7.4). This will give the planner the option of a hashaggregate
which could be significantly faster than the other methods.
--
Josh Berkus
Aglio Database Solutions
San Francisco
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-performance@postgresql.org
Cc: josh@agliodbs.com, schisholm@sandvine.com
Subject: Re: Performance tradeoff
In-Reply-To: <200503022131.01658.josh@agliodbs.com>
* 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