Re: way to speed up a SELECT DISTINCT? - Mailing list pgsql-performance

From Seth Ladd
Subject Re: way to speed up a SELECT DISTINCT?
Date
Msg-id 9BE142FC-FB0F-11D7-A8D2-000A9576D038@picklematrix.net
Whole thread Raw
In response to Re: way to speed up a SELECT DISTINCT?  (Peter Childs <blue.dragon@blueyonder.co.uk>)
Responses Re: way to speed up a SELECT DISTINCT?  (Shridhar Daithankar <shridhar_daithankar@persistent.co.in>)
Re: way to speed up a SELECT DISTINCT?  (Christopher Kings-Lynne <chriskl@familyhealth.com.au>)
Re: way to speed up a SELECT DISTINCT?  (Peter Childs <blue.dragon@blueyonder.co.uk>)
List pgsql-performance
>> Is there any way to speed this up, or is that DISTINCT going to keep
>> hounding me?
>>
>> I checked the mailing list, and didn't see anything like this.
>>
>> Any tips or hints would be greatly appreciated.  Thanks for your help!
>> Seth
>>
>>
>     Try group by instead. I think this is an old bug its fixed in
> 7.3.2 which I'm using.
>
> Peter Childs
> `
>
>
> peter@bernardo:express=# explain select distinct region from region;
>                                           QUERY PLAN
> -----------------------------------------------------------------------
> -----------------------
>  Unique  (cost=0.00..4326.95 rows=9518 width=14)
>    ->  Index Scan using regionview_region on region
> (cost=0.00..4089.00
> rows=95183 width=14)
> (2 rows)

Thanks for the tip, I'll give this a shot soon.  I am curious, your
example above does not use GROUP BY yet you have an INDEX SCAN.  I am
using a similar query, yet I get a full table scan.  I wonder how they
are different?

I'll try the group by anyway.

Thanks,
Seth


pgsql-performance by date:

Previous
From: Peter Childs
Date:
Subject: Re: way to speed up a SELECT DISTINCT?
Next
From: Shridhar Daithankar
Date:
Subject: Re: way to speed up a SELECT DISTINCT?