pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Craig Ringer <craig@postnewspapers.com.au>
Cc: Einars <einars@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Chaotically weird execution plan
Date: Tue, 23 Sep 2008 23:01:10 -0400
Message-ID: <17643.1222225270@sss.pgh.pa.us> (raw)
In-Reply-To: <48D9943B.9060801@postnewspapers.com.au>
References: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com>
	<48D9943B.9060801@postnewspapers.com.au>

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.

			regards, tom lane



view thread (6+ messages)  latest in thread

Message-ID: <17643.1222225270@sss.pgh.pa.us>
Permalink:  ../17643.1222225270@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/17643.1222225270@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, craig@postnewspapers.com.au, einars@gmail.com
  Subject: Re: Chaotically weird execution plan
  In-Reply-To: <17643.1222225270@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox