Re: HashAggregate slower than sort?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Jatinder Sangha" <js(at)coalition(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: HashAggregate slower than sort?
Date: 2010-06-21 13:53:44
Message-ID: 4C1F289802000025000326B6@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Jatinder Sangha" <js(at)coalition(dot)com> wrote:

> I've already converted all of my SQL to use "distinct on (...)"
> and this is now always faster using the hash-aggregates than when
> using sorting. The queries now only use sorting if the hashing
> would take up too much memory.

It's great that you have a solution to your immediate problem, but
if the active portion of your database is really as fully cached as
your problem case indicates, you should probably still tweak the
costing factors. Doing so will help the optimizer pick good plans
for any arbitrary query you choose to run. If the caching was
unusual, and was just showing up because were repeatedly running
that one test case, then never mind. :-)

-Kevin

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Sergio Charpinel Jr. 2010-06-21 14:42:14 Low perfomance SUM and Group by large databse
Previous Message Jatinder Sangha 2010-06-21 09:58:34 Re: HashAggregate slower than sort?