Skip site navigation (1) Skip section navigation (2)

Patch for Re: [HACKERS] Caching number of blocks in relation to avoi lseek.

From: Denis Perchine <dyp(at)perchine(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Patch for Re: [HACKERS] Caching number of blocks in relation to avoi lseek.
Date: 2000-06-13 08:19:52
Message-ID: 00061315252504.00525@dyp (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
> Oh.  Hmm.  Not sure if it's really worth the trouble, but you could try
> having fd.c keep track of the current seek position of VFDs when they
> are open as well as when they are closed, and optimize away the lseek
> call in FileSeek if the position is already right.  You'd have to think
> carefully about what to do if a read or write fails, however --- where
> has the kernel left its seek position in that case?  Possibly this could
> be dealt with by setting the internal position to "unknown" anytime
> we're not perfectly sure where the kernel is.

If read or write fails. Position will left the same. This situation is already tracked
in File routines, but a little bit incorrectly.

Here is the full patch for this. This patch reduce amount of lseek call ten times
for update statement and twenty times for select statement. I tested joined update
and count(*) select for table with rows > 170000 and 10 indices.
I think this is worse of trying. Before lseek calls account for more than 5% of time.
Now they are 0.89 and 0.15 respectevly.

Due to only one file modification patch should be applied in src/backedn/storage/file/ dir.

Sincerely Yours,
Denis Perchine

E-Mail: dyp(at)perchine(dot)com
FidoNet: 2:5000/120.5

Attachment: fd.c.patch
Description: text/plain (1.1 KB)

In response to


pgsql-hackers by date

Next:From: Oleg BroytmannDate: 2000-06-13 08:29:41
Subject: Re: setproctitle
Previous:From: Bruce MomjianDate: 2000-06-13 08:09:23
Subject: Re: memory management suggestion

pgsql-patches by date

Next:From: Denis PerchineDate: 2000-06-13 08:37:58
Subject: Patch 0.2 for Re: [HACKERS] Caching number of blocks in relation to avoi lseek.
Previous:From: Bruce MomjianDate: 2000-06-13 07:48:05
Subject: Re: Patches for SGI IRIX 6.x

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group