Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 0E7291336971 for ; Tue, 21 Sep 2010 16:02:20 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 27364-10 for ; Tue, 21 Sep 2010 19:02:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mxout-07.mxes.net (mxout-07.mxes.net [216.86.168.182]) by mail.postgresql.org (Postfix) with ESMTP id F350F133616B for ; Tue, 21 Sep 2010 16:02:12 -0300 (ADT) Received: from [192.168.1.104] (unknown [173.165.13.38]) by smtp.mxes.net (Postfix) with ESMTPA id 3444E22E256; Tue, 21 Sep 2010 15:02:11 -0400 (EDT) Subject: Re: Query much faster with enable_seqscan=0 Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Ogden In-Reply-To: <4C98FEA2.8030607@krogh.cc> Date: Tue, 21 Sep 2010 14:02:11 -0500 Cc: Kenneth Marshall , pgsql-performance@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <3062DF4E-7460-4487-818A-BF77F176E501@darkstatic.com> References: <0D5B9ED0-00C3-4EEB-8336-0B2F8A884620@darkstatic.com> <20100921180618.GI17152@aart.is.rice.edu> <4C98FEA2.8030607@krogh.cc> To: Jesper Krogh X-Mailer: Apple Mail (2.1081) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201009/128 X-Sequence-Number: 40331 How odd, I set the following: seq_page_cost =3D 1.0 =20 random_page_cost =3D 2.0 And now the query runs in milliseconds as opposed to 14 seconds. Could = this really be the change? I am running ANALYZE now - how often is it = recommended to do this? Thank you Ogden On Sep 21, 2010, at 1:51 PM, Jesper Krogh wrote: > On 2010-09-21 20:21, Ogden wrote: >> I assume you mean random_page_cost? It is currently set to 4.0 - is = it better to increase or decrease this value? >> =20 >=20 > Should be lowered to a bit over seq_page_cost.. and more = importantly.. you should > make sure that you have updated your statistics .. run "ANALYZE"; >=20 > --=20 > Jesper >=20 > --=20 > Sent via pgsql-performance mailing list = (pgsql-performance@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance