Victor Yegorov <vyegorov@gmail.com> writes:
> Settings:
> random_page_cost 2.5 ¤
> seq_page_cost 1 ¤
> Question is — why IndexScan over partial index is estimated less than
> BitmapHeap + BitmapIndex scan. And how can I tell Planner, that IndexScan
> over 1/3 of table is not a good thing — IndexScan is touching 10x more
> pages and in a typical situation those are cold.
In that case you've got random_page_cost too far down. Values less than
the default of 4 are generally only appropriate if the bulk of your
database stays in RAM.
regards, tom lane