Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4D18C64FC0D for ; Wed, 24 Sep 2008 00:01:16 -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 90525-10 for ; Wed, 24 Sep 2008 00:01:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id A680B64FC15 for ; Wed, 24 Sep 2008 00:01:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m8O31AiJ017644; Tue, 23 Sep 2008 23:01:10 -0400 (EDT) To: Craig Ringer cc: Einars , pgsql-performance@postgresql.org Subject: Re: Chaotically weird execution plan In-reply-to: <48D9943B.9060801@postnewspapers.com.au> References: <4f8bd5c90809231753xbcdacd2xfba4d38c2eb34faf@mail.gmail.com> <48D9943B.9060801@postnewspapers.com.au> Comments: In-reply-to Craig Ringer message dated "Wed, 24 Sep 2008 09:13:31 +0800" Date: Tue, 23 Sep 2008 23:01:10 -0400 Message-ID: <17643.1222225270@sss.pgh.pa.us> From: Tom Lane 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/208 X-Sequence-Number: 31521 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. regards, tom lane