Re: Select distinct sorting all rows 8.0rc1 - Mailing list pgsql-general

From Guy Rouillier
Subject Re: Select distinct sorting all rows 8.0rc1
Date
Msg-id CC1CF380F4D70844B01D45982E671B2348E46B@mtxexch01.add0.masergy.com
Whole thread Raw
In response to Select distinct sorting all rows 8.0rc1  ("Guy Rouillier" <guyr@masergy.com>)
List pgsql-general
Pierre-Frédéric Caillaud wrote:
>     The planner is smarter with GROUP BY than with DISTINCT, so you can
> rewrite your query as the following, whihc will probaly use a
> HashAggregate, and be a lot faster :
>
>     SELECT service_id FROM five_min_stats_200408 GROUP BY service_id;

Pierre-Frédéric, thanks!  Vast improvement - this is definitely acceptable.  It did indeed use a seq scan followed by a
hashaggregate. 

 Total runtime: 76295.775 ms


>> estat=> explain analyze select distinct(service_id) from
>> five_min_stats_200408; QUERY PLAN
>> ------------------------------------------------------------------------
>> ------------------------------------------------------------------------
>>
>> Time: 1284213.359 ms



--
Guy Rouillier


pgsql-general by date:

Previous
From: OpenMacNews
Date:
Subject: Re: initdb error: "could not identify current directory"
Next
From: Greg Stark
Date:
Subject: Re: source control integration