Re: Prereading using posix_fadvise (was Re: Commitfest patches) - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Prereading using posix_fadvise (was Re: Commitfest patches)
Date
Msg-id 20080328155824.GD9150@svana.org
Whole thread Raw
In response to Re: Prereading using posix_fadvise (was Re: Commitfest patches)  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
On Fri, Mar 28, 2008 at 11:41:58AM -0400, Bruce Momjian wrote:
> Should we consider only telling the kernel X pages ahead, meaning when
> we are on page 10 we tell it about page 16?

It's not so interesting for sequential reads, the kernel can work that
out for itself. Disk reads are usually in blocks of at least 128K
anyway, so there's a real good chance you have block 16 already.

The interesting case is index scan, where you so a posix_fadvise() on
the next block *before* returning the items in the current block. Then
by the time you've processed these tuples, the next block will
hopefully have been read in and we can proceed without delay.

Or fadvising all the tuples referred to from an index page at once so
the kernel can determine the optimal order to fetch them. The read()
will still be in order of the tuple, but the delay will (hopefully) be
less.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Commitfest patches
Next
From: Heikki Linnakangas
Date:
Subject: Re: Prereading using posix_fadvise (was Re: Commitfest patches)