Re: [PATCH] Using pread instead of lseek (with analysis)

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: pgsql-patches(at)postgresql(dot)org
Subject: Re: [PATCH] Using pread instead of lseek (with analysis)
Date: 2005-10-10 14:52:16
Message-ID: 20051010145209.GA29638@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Sun, Oct 09, 2005 at 12:19:57AM +0200, Martijn van Oosterhout wrote:
> > It would be reasonable to check results in fully-cached cases, which
> > would be the best real-world scenario for this to show any improvement
> > in.
>
> If you look, I did that and even then it simply didn't make a
> difference. lseek is 10 microseconds, you'd need to do hundreds of
> thousands of them to make a difference. And any gain would disappear in
> just the rotational latency of a hard disk read.

Just to clarify, I reexamined this point and there is a small
difference. The fully cached case went from 72 seconds to 70 over
890,000 (p)read syscalls, indicating that in that case lseek/read is
slower than pread by about 2 microseconds per call. The overall benefit
is about 2.5%.

This doesn't change the fact that any disk access at all renders the
benefit almost nil. On Linux anyway, other OSes, who knows?

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Martin Pitt 2005-10-11 19:13:15 My investigations of the postmaster Bus error
Previous Message Qingqing Zhou 2005-10-09 10:58:11 Re: [PATCH] Using pread instead of lseek (with analysis)