Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id EAB279FA084 for ; Mon, 10 Sep 2007 19:22:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 84961-02 for ; Mon, 10 Sep 2007 19:22:09 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from ironport2-out.pppoe.ca (ironport2-out.pppoe.ca [206.248.154.182]) by postgresql.org (Postfix) with ESMTP id 8249F9F9D04 for ; Mon, 10 Sep 2007 19:22:08 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4FAGhg5UbO+Igp/2dsb2JhbACCQTWILA X-IronPort-AV: E=Sophos;i="4.20,233,1186372800"; d="scan'208,217";a="6206393" Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 10 Sep 2007 18:22:07 -0400 Received: from [206.248.136.41] ([206.248.136.41]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id PFG39407; Mon, 10 Sep 2007 18:22:07 -0400 Message-ID: <46E5C38E.8030806@mark.mielke.cc> Date: Mon, 10 Sep 2007 18:22:06 -0400 From: Mark Mielke User-Agent: Thunderbird 2.0.0.5 (X11/20070719) MIME-Version: 1.0 To: Scott Marlowe CC: Gregory Stark , Luke Lonergan , Carlo Stonebanks , pgsql-performance@postgresql.org Subject: Re: random_page_costs - are defaults of 4.0 realistic for SCSI RAID 1 References: <87y7fekxga.fsf@oxford.xeocode.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------000809090901020801070505" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/166 X-Sequence-Number: 26711 This is a multi-part message in MIME format. --------------000809090901020801070505 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Scott Marlowe wrote: > On 9/10/07, Gregory Stark wrote: > >> "Luke Lonergan" writes: >> >>> Should be a lot higher, something like 10-15 is approximating accurate. >>> >> Most people's experience is that due to Postgres underestimating the benefits >> of caching lowering the random_page_cost is helpful. >> > Quite often the real problem is that they have effective_cache_size > too small, and they use random_page_cost to get the planner to switch > to index scans on small tables. With a large effective_cache_size and > small to moderate table (i.e. it fits in memory pretty handily) the > planner seems much better in the last few major releases about picking > an index over a sequential scan In my case, I set effective_cache_size to 25% of the RAM available to the system (256 Mbytes), for a database that was about 100 Mbytes or less. I found performance to increase when reducing random_page_cost from 4.0 to 3.0. For a database that truly fits entirely in memory, I assume random_page_cost is closer to 1.0. The planner should know that there is no significant seek cost for RAM. I will try to compare results tonight using 8.2. The last time I checked may have been 8.1. I am also curious to see what the current algorithm is with regard to effective_cache_size. Cheers, mark -- Mark Mielke --------------000809090901020801070505 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Scott Marlowe wrote:
On 9/10/07, Gregory Stark <stark@enterprisedb.com> wrote:
  
"Luke Lonergan" <llonergan@greenplum.com> writes:
    
Should be a lot higher, something like 10-15 is approximating accurate.
      
Most people's experience is that due to Postgres underestimating the benefits
of caching lowering the random_page_cost is helpful.
    
Quite often the real problem is that they have effective_cache_size
too small, and they use random_page_cost to get the planner to switch
to index scans on small tables.  With a large effective_cache_size and
small to moderate table (i.e. it fits in memory pretty handily) the
planner seems much better in the last few major releases about picking
an index over a sequential scan
In my case, I set effective_cache_size to 25% of the RAM available to the system (256 Mbytes), for a database that was about 100 Mbytes or less. I found performance to increase when reducing random_page_cost from 4.0 to 3.0.

For a database that truly fits entirely in memory, I assume random_page_cost is closer to 1.0. The planner should know that there is no significant seek cost for RAM.

I will try to compare results tonight using 8.2. The last time I checked may have been 8.1. I am also curious to see what the current algorithm is with regard to effective_cache_size.

Cheers,
mark

-- 
Mark Mielke <mark@mielke.cc>
--------------000809090901020801070505--