Re: select distinct

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Timothy H(dot) Keitt" <keitt(at)nceas(dot)ucsb(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: select distinct
Date: 2000-07-29 02:55:00
Message-ID: 4066.964839300@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"Timothy H. Keitt" <keitt(at)nceas(dot)ucsb(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Lockhart 2000-07-29 03:29:52 Re: Questionable coding in proc.c & lock.c
Previous Message Timothy H. Keitt 2000-07-28 23:36:50 select distinct