Re: planner costs in "warm cache" tests

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Carey <scott(at)richrelevance(dot)com>
Cc: Jesper Krogh <jesper(at)krogh(dot)cc>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: planner costs in "warm cache" tests
Date: 2010-06-01 14:03:38
Message-ID: 2193.1275401018@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Scott Carey <scott(at)richrelevance(dot)com> 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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Torsten Zühlsdorff 2010-06-01 15:03:48 How to insert a bulk of data with unique-violations very fast
Previous Message Brad Nicholson 2010-06-01 13:17:31 Re: Zeus IOPS