Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Thomas Hamilton <thomashamilton76(at)yahoo(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY
Date: 2009-12-03 17:49:51
Message-ID: 20091203174951.GI5059@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thomas Hamilton wrote:

> When run against a large dataset with a small number of distinct results
> HashAggregate is an order of magnitude more efficient!
>
> Since the spec does not require DISTINCT to return sorted results, I don't
> believe Sort ... Unique will ever be more efficient than HashAggregate.

This is not a bug -- merely a missing optimizer feature, which as it
turns out was implemented in 8.4.

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message David Gardner 2009-12-03 20:06:59 BUG #5232: plpythonu s=s.op() raises an exception
Previous Message Joshua Tolley 2009-12-03 16:24:52 Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY