Re: Chaotically weird execution plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Einars <einars(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Chaotically weird execution plan
Date: 2008-09-24 03:01:10
Message-ID: 17643.1222225270@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Craig Ringer <craig(at)postnewspapers(dot)com(dot)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.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Craig Ringer 2008-09-24 03:12:26 Re: Chaotically weird execution plan
Previous Message Tom Lane 2008-09-24 02:58:10 Re: Chaotically weird execution plan