Re: performance: use pread instead of lseek+read - Mailing list pgsql-patches

From Tom Lane
Subject Re: performance: use pread instead of lseek+read
Date
Msg-id 5494.1046120638@sss.pgh.pa.us
Whole thread Raw
In response to performance: use pread instead of lseek+read  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: performance: use pread instead of lseek+read  (Manfred Spraul <manfred@colorfullife.com>)
List pgsql-patches
Manfred Spraul <manfred@colorfullife.com> writes:
> What about removing lseek entirely and using the p{read,write}?

Portability.

$ man pread
No manual entry for pread.
$

It seems unlikely to me that eliminating lseek on some platforms would
be worth the hassle of maintaining two code paths.  lseek is mighty
cheap as system calls go.  What's worse, a series of preads (as opposed
to reads without intervening lseek) might not trigger kernel read-ahead
optimizations, in which case this would be a tremendous disimprovement.

> Attached is a patch vs the cvs tree.
> It seems to work - 7.3.2 with the patch applied passes the regression

Can you measure any performance benefit?

            regards, tom lane

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: to_char PL/MI fix
Next
From: Manfred Spraul
Date:
Subject: Re: performance: use pread instead of lseek+read