How can we accrately estimate the "seq_page_fetch" and "random_page_fetch"
costs from outside the postgres using for example a C routine. Using a very
simple program in C, I have two sets of files. I want to access one set
randomly i.e. pulling data from random locations within the files. The second
set of files is accessed sequentially. The goal here is to approximate the disk
I/O cost for a "random page fetch" and a "sequential page fetch" respectively.
I am using low-level(unbuffered) C routines i.e. read/write and lseek ( for
positioning file pointer), the read/write buffer size is 8k (to match the size
of postgres page), and Linux is the host OS. We all know that linux is a
heavily cached OS, for that very reason I am using sets of files instead of a
single file, in a hope that whenever a new file from a set of files is accessed
for the first time, it will NOT be in the OS cache, thus giving accurate
results of actually fetching the file pages from the physical disk. And also
the host is restarted before running the experiment so as to force a cold-cache
I am hoping somebody could point me in the right direction.