Re: BUG #2441: All useable indexes for an IN are used, not just one

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Arjen van der Meijden" <acmmailing(at)tweakers(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2441: All useable indexes for an IN are used, not just one
Date: 2006-05-18 19:57:52
Message-ID: 20275.1147982272@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Arjen van der Meijden" <acmmailing(at)tweakers(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Jagadish Prasath Ramu 2006-05-19 10:09:24 BUG #2444: XA Connections given by posgres driver has auto-commit value false by default
Previous Message Tom Lane 2006-05-18 14:12:13 Re: Bug in PL/Perl 8.1.3