Re: Getting rid of some more lseek() calls

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andres Freund <andres@anarazel.de>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2020-02-12T05:42:01Z
Lists: pgsql-hackers
On Tue, Feb 11, 2020 at 06:04:09PM +1300, Thomas Munro wrote:
> lseek(SEEK_END) seems to be nearly twice as fast as fstat() if you
> just call it in a big loop, on Linux and FreeBSD (though I didn't
> investigate exactly why, mitigations etc, it certainly returns more
> stuff so there's that).

Interesting.  What of Windows?  We've had for some time now problem
with fetching the size of files larger than 4GB (COPY, dumps..).  I am
wondering if we could not take advantage of that for those cases:
https://www.postgresql.org/message-id/15858-9572469fd3b73263@postgresql.org
--
Michael

Commits

  1. Use pg_pread() and pg_pwrite() in slru.c.

  2. Use pg_pwrite() in more places.