Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id CDD8D632DD8 for ; Tue, 1 Jun 2010 11:05:02 -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 33927-08 for ; Tue, 1 Jun 2010 14:04: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 B1EC6632BCA for ; Tue, 1 Jun 2010 11:04:55 -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 o51E3cQg002194; Tue, 1 Jun 2010 10:03:38 -0400 (EDT) To: Scott Carey cc: Jesper Krogh , "pgsql-performance@postgresql.org" Subject: Re: planner costs in "warm cache" tests In-reply-to: <31D5250B-7392-45DD-A234-8A5BBFF8F49A@richrelevance.com> References: <4C02A342.40801@krogh.cc> <14644.1275244491@sss.pgh.pa.us> <4C040488.30906@krogh.cc> <18310.1275335733@sss.pgh.pa.us> <31D5250B-7392-45DD-A234-8A5BBFF8F49A@richrelevance.com> Comments: In-reply-to Scott Carey message dated "Tue, 01 Jun 2010 00:13:22 -0700" Date: Tue, 01 Jun 2010 10:03:38 -0400 Message-ID: <2193.1275401018@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_20=-0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201006/8 X-Sequence-Number: 38864 Scott Carey writes: > It is still best to have random_page_cost to be slightly larger (~50%) > than sequential_page_cost, because even when entirely in RAM, > sequential reads are faster than random reads. Today's CPU's do > memory prefetching on sequential access. Do you have any actual evidence of that? Because I don't believe it. Neither PG nor any kernel that I've ever heard of makes any effort to ensure that logically sequential blocks occupy physically sequential buffers, so even if the CPU tries to do some prefetching, it's not going to help at all. Now, if the database isn't entirely cached, then indeed it's a good idea to keep random_page_cost higher than seq_page_cost. But that's because of the actual disk fetches, not anything that happens in RAM. regards, tom lane