"Jim C. Nasby" <jim@nasby.net> writes:
> It seems like the metrics used for the cost of index scanning v. table
> scanning on large tables need to be revisited. It might be such a huge
> difference in this case because the table is essentially clustered on
> the primary key.
Probably. What does the correlation figure in pg_stats show as?
There's been some previous debate about the equation used to correct
for correlation, which is certainly bogus (I picked it more or less
out of the air ;-)). But so far no one has proposed a replacement
equation with any better foundation ... take a look in
src/backend/optimizer/path/costsize.c if you want to get involved.
> Also, is there a TODO to impliment
> real clustered indexes?
No. It's not apparent to me how you could do that without abandoning
MVCC, which we're not likely to do.
regards, tom lane