"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