"Kevin Grittner" <[EMAIL PROTECTED]> writes: > In both the 8.1beta2 and using a build from this morning's > dev snapshot, this query ran slower than expected:
There's a known issue that the planner tends to overestimate the cost of inner-index-scan nestloops, because it doesn't allow for the strong caching effects associated with repeated scans of the same index (in particular, that all the upper index levels tend to stay in cache). See the archives for past inconclusive discussions about how to fix this. However, something else caught my eye: > -> Bitmap Heap Scan on "DbTranRepository" dtr > (cost=297.07..47081.47 rows=25067 width=17) (actual time=69.056..5560.895 > rows=39690 loops=1) > -> Index Scan using "DbTranRepository_timestamp" on > "DbTranRepository" dtr (cost=0.00..49419.45 rows=25067 width=17) (actual > time=33.625..11510.723 rows=39690 loops=1) I don't understand why the second case chose a plain index scan when there was no need for sorted output; the bitmap scan is faster both per cost estimate and in reality. Are you sure you turned off only enable_mergejoin and not enable_bitmapscan? Also, when you say "slower than expected", what is setting your expectation? regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 4: Have you searched our list archives? http://archives.postgresql.org