performance: use pread instead of lseek+read

From: Manfred Spraul <manfred(at)colorfullife(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: performance: use pread instead of lseek+read
Date: 2003-02-24 18:24:09
Message-ID: 3E5A6349.4060900@colorfullife.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hi all,

postgresql tries very hard to avoid calling lseek if not needed,
probably to avoid doing unnecessary syscalls.
What about removing lseek entirely and using the p{read,write}?

pread is identical to the normal read syscall, except that it has one
additional parameter: the position from which the data should be read.
All recent unices support that, it's part of POSIX.1c.

Attached is a patch vs the cvs tree.
It seems to work - 7.3.2 with the patch applied passes the regression
test suite on RH Linux.
Untested with cvs-head, preproc.y causes a parser overflow.

What do you think?
- configure: I test for existance of pread, and assume that pwrite will
exist, too. Acceptable?
- Are you interested in further patches? xlog.c contains a few lseeks,
but I doubt that they are in the critical path.

--
Manfred

Attachment Content-Type Size
patch-pread text/plain 3.5 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2003-02-24 18:35:15 Re: psql patch
Previous Message Jeroen T. Vermeulen 2003-02-24 18:13:43 Re: psql patch