Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id E09AFB5DBE0 for ; Mon, 20 Jun 2011 23:25:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 44403-06 for ; Tue, 21 Jun 2011 02:25:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hackers.mr.itd.umich.edu (smtp.mail.umich.edu [141.211.14.81]) by mail.postgresql.org (Postfix) with ESMTP id 7F0EEB5DBD3 for ; Mon, 20 Jun 2011 23:25:45 -0300 (ADT) Received: FROM [192.168.0.101] (Mismatch [122.167.225.216]) By hackers.mr.itd.umich.edu ID 4E000124.339A.30714 ; Authuser sushant; 20 Jun 2011 22:25:41 EDT Subject: Re: sequential scan unduly favored over text search gin index From: Sushant Sinha Reply-To: sushant354@gmail.com To: Tomas Vondra Cc: pgsql-performance@postgresql.org In-Reply-To: <4DFF990F.8080906@fuzzy.cz> References: <1308584339.2488.12.camel@dragflick> <4DFF27C5020000250003E9A4@gw.wicourts.gov> <1308585840.2488.13.camel@dragflick> <4DFF990F.8080906@fuzzy.cz> Content-Type: text/plain; charset="UTF-8" Date: Tue, 21 Jun 2011 07:55:34 +0530 Message-ID: <1308623134.1747.1.camel@dragflick> Mime-Version: 1.0 X-Mailer: Evolution 2.32.2 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.344 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_ENVFROM_END_DIGIT=1.553, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001, UNPARSEABLE_RELAY=0.001 X-Spam-Level: X-Archive-Number: 201106/188 X-Sequence-Number: 44121 > > I agree the estimates are damn precise in this case (actually the > estimates are exact). The problem is the planner thinks the seq scan is > about 30% cheaper than the bitmap index scan. > > I guess you could poke the planner towards the bitmap scan by lowering > the random_page_cost (the default value is 4, I'd say lowering it to 2 > should do the trick). The numbers that I gave was after setting random_page_cost = 1.0 After this I don't know what to do. -Sushant.