Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id AA53B64FC15 for ; Wed, 24 Sep 2008 00:12:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 96387-04 for ; Wed, 24 Sep 2008 00:12:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [202.61.230.242]) by postgresql.org (Postfix) with ESMTP id EEA0E64FC0D for ; Wed, 24 Sep 2008 00:12:42 -0300 (ADT) Received: from mail.postnewspapers.com.au (202-89-185-120.static.dsl.amnet.net.au [202.89.185.120]) by www.postnewspapers.com.au (Postfix) with ESMTP id 614705C0E1 for ; Wed, 24 Sep 2008 11:12:38 +0800 (WST) Received: from [10.0.0.53] (wallace.localnet [10.0.0.53]) by mail.postnewspapers.com.au (Postfix) with ESMTP id 5549B1E0434 for ; Wed, 24 Sep 2008 11:12:38 +0800 (WST) Message-ID: <48D9B01A.5010702@postnewspapers.com.au> Date: Wed, 24 Sep 2008 11:12:26 +0800 From: Craig Ringer User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: Chaotically weird execution plan References: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com> <48D9943B.9060801@postnewspapers.com.au> <17643.1222225270@sss.pgh.pa.us> In-Reply-To: <17643.1222225270@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/209 X-Sequence-Number: 31522 Tom Lane wrote: > Craig Ringer 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