Re: PG 7.0 is 2.5 times slower running a big report

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Matthias Urlichs <smurf(at)noris(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bryan White <bryan(at)arcamax(dot)com>, Jesse Estevez <jestevez(at)travel-italy(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG 7.0 is 2.5 times slower running a big report
Date: 2000-05-26 14:51:17
Message-ID: 200005261451.KAA22742@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Hi,
>
> Bruce Momjian:
> > As I remember, Linux turns off file system prefetch if a seek is done.
>
> Correct (still so for Linux 2.4).
>
> > BSD file systems turn off prefetch only if prefetched blocks remain
> > unused.
>
> "Unused" is decided when?
> Do any, all, or some percentage of prefetched blocks need to be unused?

It starts out prefetching blocks on first file read. In later reads, if
the desired block is in the cache, it continues read-ahead and may even
scale up the read-ahead window.

If the desired block is not in the cache, it starts to think it is
reading ahead too much or random reads are being done, and scales back
the read-ahead window.

It knows if the current read is sequential from from the previous read,
and can scale up the read-ahead window in those cases.

So the case where a file is being read sequentially but in two sections
at the same time should work fine because the read-aheads are being
used.

It basically a feedback loop causing a read that is sequential from a
previous read to make the read-ahead go up, and a read that is not in
the cache to make the read-ahead go down.

At least that is how I am reading the BSDI code. I could send a bit of
the code over, but it is pretty confusing.

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2000-05-26 14:52:30 Re: PG 7.0 is 2.5 times slower running a big report
Previous Message Steve Wampler 2000-05-26 14:18:30 Speed of locating tables?