Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BBFED9F9B64 for ; Wed, 29 Aug 2007 05:16:57 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 93879-02 for ; Wed, 29 Aug 2007 05:16:54 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from smtp.wayr.org (wayr.org [88.191.18.57]) by postgresql.org (Postfix) with ESMTP id D0C959F9B50 for ; Wed, 29 Aug 2007 05:16:54 -0300 (ADT) Received: from [192.168.22.6] (staff.syllage.fr [213.186.54.121]) by smtp.wayr.org (Postfix) with ESMTP id 2B2B0B93F; Wed, 29 Aug 2007 10:16:48 +0200 (CEST) Subject: Re: index & Bitmap Heap Scan From: Paul To: Tom Lane Cc: pgsql-performance@postgresql.org In-Reply-To: <29055.1188320158@sss.pgh.pa.us> References: <1188290949.29582.9.camel@thory> <29055.1188320158@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Date: Wed, 29 Aug 2007 10:16:45 +0200 Message-Id: <1188375405.9028.3.camel@thory> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/371 X-Sequence-Number: 26501 Thank you for your answer. Now i ve to find how to reduce the size of the table. Paul. Le mardi 28 août 2007 à 12:55 -0400, Tom Lane a écrit : > Paul writes: > > Why in the first case, pgsql uses the "better" index and if i search > > r_service instead of r_numero pgsql does a "Bitmap Heap scan" first ? > > Given the difference in the number of rows to be fetched, both plan > choices look pretty reasonable to me. If you want to experiment, > you can try forcing the other choice in each case (use enable_indexscan > and enable_bitmapscan) and see how fast it is, but I suspect the planner > got it right. > > Beware of cache effects when trying two plans in quick succession --- > the second one might go faster just because all the data is already > swapped in. > > regards, tom lane >