Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 340B09FBE2A for ; Wed, 9 May 2007 12:56:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 34920-08-2 for ; Wed, 9 May 2007 12:56:17 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 759CA9FBF46 for ; Wed, 9 May 2007 12:56:17 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l49FuDDe027553; Wed, 9 May 2007 11:56:13 -0400 (EDT) To: Peter Eisentraut cc: Alvaro Herrera , pgsql-performance@postgresql.org Subject: Re: Apparently useless bitmap scans In-reply-to: <200705091726.03455.peter_e@gmx.net> References: <200705091410.57312.peter_e@gmx.net> <20070509142914.GD4504@alvh.no-ip.org> <200705091726.03455.peter_e@gmx.net> Comments: In-reply-to Peter Eisentraut message dated "Wed, 09 May 2007 17:26:03 +0200" Date: Wed, 09 May 2007 11:56:13 -0400 Message-ID: <27552.1178726173@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/198 X-Sequence-Number: 24588 Peter Eisentraut writes: > OK, upgrading to 8.2.4 fixes this odd plan choice. The query does run > a bit faster too, but the cost estimate has actually gone up! Yeah, because the former code was making an unrealistically small estimate of the number of tuples found by BitmapAnd (due to double-counting the selectivities of redundant indexes), and of course that means a smaller estimate of the cost to fetch them in the bitmap heap scan. regards, tom lane