stig erikson <stigerikson_nospam_@yahoo.se> writes:
> the question is simply why the planner is not smart enough to skip the bitmap scan if normal operation is faster.
Probably because it hasn't got good statistics about the distribution of
"bid":
> -> Bitmap Index Scan on bid_index (cost=0.00..44.51 rows=7576 width=0) (actual time=0.137..0.137
rows=506loops=1)
> Index Cond: (bid = 17675)
When the rowcount estimate is off by more than a factor of 10, the costs
are going to be wrong too. Try increasing the statistics target for this
table.
regards, tom lane