Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3DC961337B8A for ; Wed, 22 Dec 2010 11:19:36 -0400 (AST) 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 15657-06 for ; Wed, 22 Dec 2010 15:19:29 +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 DC3A31337B83 for ; Wed, 22 Dec 2010 11:19:28 -0400 (AST) 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 oBMFJSw7005210; Wed, 22 Dec 2010 10:19:28 -0500 (EST) To: =?ISO-8859-2?Q?pasman_pasma=F1ski?= cc: pgsql-performance@postgresql.org Subject: Re: Query uses incorrect index In-reply-to: References: Comments: In-reply-to =?ISO-8859-2?Q?pasman_pasma=F1ski?= message dated "Wed, 22 Dec 2010 10:22:00 +0100" Date: Wed, 22 Dec 2010 10:19:28 -0500 Message-ID: <5209.1293031168@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: 201012/282 X-Sequence-Number: 41734 =?ISO-8859-2?Q?pasman_pasma=F1ski?= writes: > Thanks for reply. > I tested random changes and query runs fastest after: > set seq_page_cost = 0.1; > set random_page_cost = 0.1; > cpu_operator_cost = 0.01 As a general rule, "optimizing" those settings on the basis of testing a single query is a great way to send your overall performance into the tank --- especially since repeating a single query will be heavily biased by cache effects. You need to look at a representative sample of all your queries across all your data. regards, tom lane