Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 96E55B5DBE3 for ; Tue, 21 Jun 2011 02:53:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 01916-03 for ; Tue, 21 Jun 2011 05:53:24 +0000 (UTC) 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 mail.postgresql.org (Postfix) with ESMTP id 44379B5DBE0 for ; Tue, 21 Jun 2011 02:53:24 -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 p5L5rJWO004290; Tue, 21 Jun 2011 01:53:19 -0400 (EDT) To: sushant354@gmail.com cc: Tomas Vondra , pgsql-performance@postgresql.org Subject: Re: sequential scan unduly favored over text search gin index In-reply-to: <1308623134.1747.1.camel@dragflick> References: <1308584339.2488.12.camel@dragflick> <4DFF27C5020000250003E9A4@gw.wicourts.gov> <1308585840.2488.13.camel@dragflick> <4DFF990F.8080906@fuzzy.cz> <1308623134.1747.1.camel@dragflick> Comments: In-reply-to Sushant Sinha message dated "Tue, 21 Jun 2011 07:55:34 +0530" Date: Tue, 21 Jun 2011 01:53:19 -0400 Message-ID: <4289.1308635599@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/191 X-Sequence-Number: 44124 Sushant Sinha writes: >> 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. I think part of the issue here is that the @@ operator is expensive, and so evaluating it once per row is expensive, but the pg_proc.procost setting for it doesn't adequately reflect that. You could experiment with tweaking that setting ... regards, tom lane