Am Dienstag, 8. Mai 2007 17:53 schrieb Tom Lane:
> Hmm, I'd have expected it to discount the repeated indexscans a lot more
> than it seems to be doing for you. As an example in the regression
> database, note what happens to the inner indexscan cost estimate when
> the number of outer tuples grows:
I can reproduce your results in the regression test database. 8.2.1 and 8.2.4
behave the same.
I checked the code around cost_index(), and the assumptions appear to be
correct (at least this query doesn't produce wildly unusual data).
Apparently, however, the caching effects are much more significant than the
model takes into account.
--
Peter Eisentraut
http://developer.postgresql.org/~petere/