Re: Performance tradeoff

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Shawn Chisholm" <schisholm(at)sandvine(dot)com>
Cc: <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Performance tradeoff
Date: 2005-03-03 05:31:01
Message-ID: 200503022131.01658.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2005-03-03 05:36:23 Re: Help with tuning this query
Previous Message John A Meinel 2005-03-03 05:04:59 Re: Help with tuning this query (more musings)