"Arjen van der Meijden" <acmmailing@tweakers.net> writes:
> filled with enough data to have it use indexes, it yields a plan involving
> all three indexes with this query:
> select * from testcase where somefk in (1, 2) and someswitch;
> Bitmap Heap Scan on testcase (cost=7.43..330.58 rows=136 width=13)
> Recheck Cond: ((somefk = ANY ('{1,2}'::integer[])) OR (somefk = ANY
> ('{1,2}'::integer[])) OR (somefk = ANY ('{1,2}'::integer[])))
> Filter: ((somefk = ANY ('{1,2}'::integer[])) AND someswitch)
> -> BitmapOr (cost=7.43..7.43 rows=410 width=0)
> -> Bitmap Index Scan on testcase_3 (cost=0.00..2.48 rows=137
> width=0)
> Index Cond: (somefk = ANY ('{1,2}'::integer[]))
> -> Bitmap Index Scan on testcase_2 (cost=0.00..2.48 rows=136
> width=0)
> Index Cond: (somefk = ANY ('{1,2}'::integer[]))
> -> Bitmap Index Scan on testcase_1 (cost=0.00..2.48 rows=137
> width=0)
> Index Cond: (somefk = ANY ('{1,2}'::integer[]))
Thanks for the report. I've applied patches to improve this.
regards, tom lane