Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 816A69F9DD3 for ; Fri, 17 Aug 2007 12:29:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 11404-09 for ; Fri, 17 Aug 2007 12:29:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from vms044pub.verizon.net (vms044pub.verizon.net [206.46.252.44]) by postgresql.org (Postfix) with ESMTP id 3E5429F99C4 for ; Fri, 17 Aug 2007 12:28:59 -0300 (ADT) Received: from osgiliath.mathom.us ([71.246.206.184]) by vms044.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JMX00JUHCCAMYN3@vms044.mailsrvcs.net> for pgsql-performance@postgresql.org; Fri, 17 Aug 2007 10:28:59 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by osgiliath.mathom.us (Postfix) with ESMTP id 0A3471F816; Fri, 17 Aug 2007 11:23:35 -0400 (EDT) Received: from osgiliath.mathom.us ([127.0.0.1]) by localhost (osgiliath.home.mathom.us [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UX1rRQd36HQT; Fri, 17 Aug 2007 11:23:30 -0400 (EDT) Received: by osgiliath.mathom.us (Postfix, from userid 1000) id 6F1C91F80E; Fri, 17 Aug 2007 11:23:30 -0400 (EDT) Date: Fri, 17 Aug 2007 11:23:29 -0400 From: Michael Stone Subject: Re: Bad planner decision - bitmap scan instead of index In-reply-to: <8797DC0C-8D0D-4F2D-A81B-4B65F8FC7382@ffnn.nl> To: Frank Schoep Cc: pgsql-performance@postgresql.org Mail-followup-to: Frank Schoep , pgsql-performance@postgresql.org Message-id: <20070817152326.GA3749@mathom.us> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii; format=flowed Content-disposition: inline X-Virus-Scanned: Debian amavisd-new at mathom.us X-Pgp-Fingerprint: 53 FF 38 00 E7 DD 0A 9C 84 52 84 C5 EE DF 7C 88 References: <20070817072839.GA6598@depesz.com> <8797DC0C-8D0D-4F2D-A81B-4B65F8FC7382@ffnn.nl> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.069 tagged_above=0 required=5 tests=AWL=0.068, BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 200708/175 X-Sequence-Number: 26305 On Fri, Aug 17, 2007 at 10:43:18AM +0200, Frank Schoep wrote: >On Aug 17, 2007, at 9:28 AM, hubert depesz lubaczewski wrote: >(cost=0.00..37612.76 rows=14221 width=48) (actual time=0.125..13.686 >rows=2000 loops=1) [snip] >I'm not an expert at how the planner decides which query plan to use, Neither am I. :) I do notice that the estimated number of rows is significantly larger than the real number; you may want to bump up your statistics a bit to see if it can estimate better. Mike Stone