determining random_page_cost value

From: Yohanes Santoso <pgsql-hackers(at)microjet(dot)ath(dot)cx>
To: pgsql-hackers mailing list <pgsql-hackers(at)postgresql(dot)org>
Subject: determining random_page_cost value
Date: 2005-10-25 16:29:21
Message-ID: 87irvlef1a.fsf@microjet.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[To admin: this message was posted earlier via google group. needless
to say, it was stalled waiting for approval, please ignore that
one. Thanks.]

Hi,

Yesterday in #pgsql, I was talking with neilc about determining rpc
value in a more concrete way. So I created a program that compares
exhaustive (all blocks are eventually read) random reads with
sequential reads. The full source is attached.

I tested the db files residing on a software RAID-1 composed of 2 IDE
7200rpm drives on linux 2.6.12.

What I discovered is:

<quote>
random_page_cost (floating point)

Sets the planner's estimate of the cost of a nonsequentially
fetched disk page. This is measured as a multiple of the cost of a
sequential page fetch. A higher value makes it more likely a
sequential scan will be used, a lower value makes it more likely
an index scan will be used. The default is four.
</quote>

is not precise enough. Which pages? Those that belong to the dbase
file or sequential pages on the media?

On dbases smaller (calculated from du <dbase_dir>)than 500M, I got a
ratio (random over sequential time) of 4.5:1. A 3.0GB dbase has a
ratio of 10:1. On a 3GB contiguous file, the ratio is about 4:1.

If, in fact, the pages meant in the quotation are pages occupied by
the dbase files, then does that mean the RPC config should be changed
over time to reflect the varying ratio (which I guess is due to file
fragmentation)? If that's the case, isn't RPC config actually a
per-database config rather than a per-cluster config?

Thanks,
YS (gnome)

Attachment Content-Type Size
determine_rpc.c text/x-csrc 7.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-10-25 17:28:00 Re: BUG #1993: Adding/subtracting negative time intervals
Previous Message Jeff Frost 2005-10-25 15:55:06 Re: Replaying archived wal files after a dump restore?