Re: sequential scan on select distinct

From: Ole Langbehn <ole(at)freiheit(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: sequential scan on select distinct
Date: 2004-10-06 16:09:43
Message-ID: 200410061809.43549.ole@freiheit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Am Mittwoch, 6. Oktober 2004 12:19 schrieb Pierre-Frédéric Caillaud:
> You could try :
>
> explain analyze select "land" from "customer_dim" group by "land";
> It will be a lot faster but I can't make it use the index on my machine...
this already speeds up my queries to about 1/4th of the time, which is about
the range of mysql and oracle.
>
> Example :
>
> [..]
>
> Hum hum ! Again, a lot better !
> Index scan backwards seems a lot faster than index scan forwards. Why, I
> don't know, but here you go from 15 seconds to 14 milliseconds...
thanks for this very extensive answer, it helped me a lot.
>
> I don't know WHY (oh why) postgres does not use this kind of strategy
> when distinct'ing an indexed field... Anybody got an idea ?
That's the big question I still would like to see answered too. Can anyone
tell us?

TiA
--
Ole Langbehn

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Greg Stark 2004-10-06 16:41:12 Re: sequential scan on select distinct
Previous Message Bill Montgomery 2004-10-06 15:45:30 Re: Excessive context switching on SMP Xeons