Re: Chaotically weird execution plan - Mailing list pgsql-performance

From Craig Ringer
Subject Re: Chaotically weird execution plan
Date
Msg-id 48D9B01A.5010702@postnewspapers.com.au
Whole thread Raw
In response to Re: Chaotically weird execution plan  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Tom Lane wrote:
> Craig Ringer <craig@postnewspapers.com.au> writes:
>> I'd already written: "If you need the test for status = 1, consider a
>> partial index" when I noticed your schema definition:
>
>>> "comments_created_by" btree (created_by) WHERE status = 1
>
>> I find it hard to guess why it's having to recheck the WHERE clause
>> given the use of a partial index that should cover that nicely.
>
> No, that's operating as designed.  A bitmap scan's RECHECK condition
> is only applied when the bitmap has become lossy due to memory
> pressure.  In that case we have to look at each row on each of the pages
> fingered by the index as containing possible matches ... and we'd better
> check the partial-index qual too, since maybe not all the rows on those
> pages will satisfy it.  In a plain indexscan there is no lossiness
> involved and so the partial-index qual need never be rechecked.

Aah. Thanks very much for the explanation of that, the plan now makes sense.

--
Craig Ringer

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: Chaotically weird execution plan
Next
From: Bruce Momjian
Date:
Subject: Re: Intel's X25-M SSD