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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "David Johnston" <polobo(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Partial Index [WHERE col IN ('A','B')] Planner Anomalies
Date: 2011-04-27 18:09:35
Message-ID: 8043.1303927775@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I wrote:
> "David Johnston" <polobo(at)yahoo(dot)com> 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 the two However, if I run
>> any other query but the three-criteria query then the flipping behavior
>> observed stops and the "Bitmap Heap" plan becomes the dominant plan. The

> Hmmm ... I'm seeing some very odd behavior here too.

The instability of the plans is a bug, and at least in the example I was
looking at, the inefficient BitmapAnd plans are a bug too. I've applied
a patch that fixes it for me. There might be related cases that are
still broken though.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message SUBHAM ROY 2011-04-27 18:11:32 Re: Needs Suggestion
Previous Message Magnus Hagander 2011-04-27 17:55:14 Re: Needs Suggestion