Re: [GENERAL] Partial Index [WHERE col IN ('A','B')] Planner Anomalies

2011-04-27 Thread Tom Lane
I wrote: > "David Johnston" writes: >> If I explain the above query multiple times (without any data changes) I get >> either of the two query plans / the Bitmap Heap one more often. If I >> analyze the table I immediately get the "Index Scan" plan first but >> subsequent explains revert to switc

Re: [GENERAL] Partial Index [WHERE col IN ('A','B')] Planner Anomalies

2011-04-26 Thread Tom Lane
"David Johnston" writes: > If I explain the above query multiple times (without any data changes) I get > either of the two query plans / the Bitmap Heap one more often. If I > analyze the table I immediately get the "Index Scan" plan first but > subsequent explains revert to switching between th

[GENERAL] Partial Index [WHERE col IN ('A','B')] Planner Anomalies

2011-04-26 Thread David Johnston
Hi, I have the following query: EXPLAIN SELECT * FROM taskinstance WHERE ti_status IN ('ACTIVE', 'DISPATCHED', 'FAILURE'); With two indices: ti_active. partial index over (ti_status) WHERE ti_status IN ('ACTIVE','DISPATCHED','FAILURE') ti_sortedstatus. full index over (ti_status, ti_c