Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 5231F63342F for ; Sun, 30 May 2010 15:35:01 -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 42298-06 for ; Sun, 30 May 2010 18:34:54 +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 628DE632F51 for ; Sun, 30 May 2010 15:34:54 -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 o4UIYpRx014645; Sun, 30 May 2010 14:34:51 -0400 (EDT) To: Jesper Krogh cc: pgsql-performance@postgresql.org Subject: Re: planner costs in "warm cache" tests In-reply-to: <4C02A342.40801@krogh.cc> References: <4C02A342.40801@krogh.cc> Comments: In-reply-to Jesper Krogh message dated "Sun, 30 May 2010 19:41:22 +0200" Date: Sun, 30 May 2010 14:34:51 -0400 Message-ID: <14644.1275244491@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.011 tagged_above=-10 required=5 tests=BAYES_40=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/268 X-Sequence-Number: 38852 Jesper Krogh writes: > testdb=# set seq_page_cost = 0.00001; > SET > testdb=# set random_page_cost = 0.00001; > SET Well, hmm, I really doubt that that represents reality either. A page access is by no means "free" even when the page is already in cache. I don't recall anyone suggesting that you set these numbers to less than perhaps 0.01. In the case at hand, the problem is that the planner is preferring using an indexscan to an after-the-fact sort to obtain the specified result ordering. Making page fetches look too cheap definitely plays into that. There may also be a statistical problem, if the location of the desired records isn't independent of the accession_number ordering, but you're not doing yourself any favors by pushing the planner cost parameters several orders of magnitude outside the design envelope. regards, tom lane