Re: select distinct - Mailing list pgsql-hackers

From Tom Lane
Subject Re: select distinct
Date
Msg-id 4066.964839300@sss.pgh.pa.us
Whole thread Raw
In response to select distinct  ("Timothy H. Keitt" <keitt@nceas.ucsb.edu>)
List pgsql-hackers
"Timothy H. Keitt" <keitt@nceas.ucsb.edu> writes:
> Couldn't you just traverse the index to get the distinct values?

No, because the index doesn't contain commit status; you can't tell
which values are actually valid without visiting the main table.

7.0 does consider both indexscan | unique and seqscan | sort | unique
plans for this problem, but the explicit sort is usually faster
(according to the system's cost models, anyway).
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Timothy H. Keitt"
Date:
Subject: select distinct
Next
From: Thomas Lockhart
Date:
Subject: Re: Questionable coding in proc.c & lock.c