Re: Sequential Scan Read-Ahead

Bruce Momjian <pgman@candle.pha.pa.us>

From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Curt Sampson <cjs@cynic.net>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2002-04-25T14:55:58Z
Lists: pgsql-hackers
Curt Sampson wrote:
> 3. Proof by testing. I wrote a little ruby program to seek to a
> random point in the first 2 GB of my raw disk partition and read
> 1-8 8K blocks of data. (This was done as one I/O request.) (Using
> the raw disk partition I avoid any filesystem buffering.) Here are
> typical results:
> 
>  125 reads of 16x8K blocks: 1.9 sec, 66.04 req/sec. 15.1 ms/req, 0.946 ms/block
>  250 reads of  8x8K blocks: 1.9 sec, 132.3 req/sec. 7.56 ms/req, 0.945 ms/block
>  500 reads of  4x8K blocks: 2.5 sec, 199 req/sec.   5.03 ms/req, 1.26 ms/block
> 1000 reads of  2x8K blocks: 3.8 sec, 261.6 req/sec. 3.82 ms/req, 1.91 ms/block
> 2000 reads of  1x8K blocks: 6.4 sec, 310.4 req/sec. 3.22 ms/req, 3.22 ms/block
> 
> The ratios of data retrieval speed per read for groups of adjacent
> 8K blocks, assuming a single 8K block reads in 1 time unit, are:
> 
>     1 block	1.00
>     2 blocks	1.18
>     4 blocks	1.56
>     8 blocks	2.34
>     16 blocks	4.68

You mention you are reading from a raw partition.  It is my
understanding that raw partition reads have no kernel read-ahead.  (I
assume this because raw devices are devices, not file system files.)  If
this is true, could we get numbers with kernel read-ahead active?

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026