Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY - Mailing list pgsql-bugs

From Alvaro Herrera
Subject Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY
Date
Msg-id 20091203174951.GI5059@alvh.no-ip.org
Whole thread Raw
In response to BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY  ("Thomas Hamilton" <thomashamilton76@yahoo.com>)
List 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.

pgsql-bugs by date:

Previous
From: Joshua Tolley
Date:
Subject: Re: BUG #5231: SELECT DISTINCT poorly implemented vs SELECT ... GROUP BY
Next
From: Heikki Linnakangas
Date:
Subject: Re: Assertion failure with a subtransaction and cursor