4 ms·
w.r.t. 2: https://www.postgresql.org/message-id/6248.1046130083%40sss.pgh.pa.us https://www.postgresql.org/message-id/6248.1046130083%40sss.... Manfred S
by fdr 10y ago
w.r.t. 2:
https://www.postgresql.org/message-id/6248.1046130083%40sss.pgh.pa.us https://www.postgresql.org/message-id/6248.1046130083%40sss....
Manfred Spraul <manfred(at)colorfullife(dot)com> writes:
> Tom Lane wrote:
>> 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.
>>
> It was considered expensive enough to write a syscall avoidance layer
> that caches the file pointer and skips lseek if fpos==offset.
You're missing the point: that layer is mostly there to ensure that we
don't foul up the kernel's readahead recognition for sequential fetches.
It's nice that Linux doesn't care, but Linux is not the only platform
we worry about.
regards, tom lane
- markpapadakis 10y agoThis ML thread's only real argument is that some OS/Kernels may not support pread/pwrite. The readahead argument makes little to no sense IMO. Unless there are too many uses of random access IO in the codebase, they should use pread and friends if available there. Especially considering most people run it on Linux not some exotic OS nowadays.