Re: planner costs in "warm cache" tests - Mailing list pgsql-performance

From Tom Lane
Subject Re: planner costs in "warm cache" tests
Date
Msg-id 2193.1275401018@sss.pgh.pa.us
Whole thread Raw
In response to Re: planner costs in "warm cache" tests  (Scott Carey <scott@richrelevance.com>)
List pgsql-performance
Scott Carey <scott@richrelevance.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

pgsql-performance by date:

Previous
From: Brad Nicholson
Date:
Subject: Re: Zeus IOPS
Next
From: Merlin Moncure
Date:
Subject: Re: PostgreSQL Function Language Performance: C vs PL/PGSQL