Re: select distinct and index usage - Mailing list pgsql-general

From Tom Lane
Subject Re: select distinct and index usage
Date
Msg-id 13767.1207621831@sss.pgh.pa.us
Whole thread Raw
In response to Re: select distinct and index usage  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: select distinct and index usage  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-general
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Tom Lane escribi�:
>> What I think you'll find, though, is that once you do force an indexscan
>> to be picked it'll be slower.  Full-table index scans are typically
>> worse than seqscan+sort, unintuitive though that may sound.

> Hmm, should we switch the CLUSTER code to do that?

It's been suggested before, but I'm not sure.  The case where an
indexscan can win is where the table is roughly in index order already.
So if you think about periodic CLUSTER to maintain table ordering,
I suspect you'd want the indexscan implementation for all but maybe
the first time.

            regards, tom lane

pgsql-general by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: select distinct and index usage
Next
From: Manuel Sugawara
Date:
Subject: Re: Cannot use a standalone backend to VACUUM in "postgres""