I wrote:
> "David Johnston" <polobo@yahoo.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