On Fri, Apr 21, 2006 at 09:38:26AM +0800, Wu Fengguang wrote: > Greetings, > > I'd like to introduce a new readahead framework for the linux kernel: > http://www.ussg.iu.edu/hypermail/linux/kernel/0603.2/1021.html > > HOW IT WORKS > > In adaptive readahead, the context based method may be of particular > interest to postgresql users. It works by peeking into the file cache > and check if there are any history pages present or accessed. In this > way it can detect almost all forms of sequential / semi-sequential read > patterns, e.g. > - parallel / interleaved sequential scans on one file > - sequential reads across file open/close > - mixed sequential / random accesses > - sparse / skimming sequential read > > It also have methods to detect some less common cases: > - reading backward > - seeking all over reading N pages Are there any ways to inform the kernel that you either are or aren't doing a sequential read? It seems that in some cases it would be better to bypass a bunch of tricky logic trying to determine that it's doing a sequential read. A sequential scan in PostgreSQL would be such a case. The opposite example would be an index scan of a highly uncorrelated index, which would produce mostly random reads from the table. In that case, reading ahead probably makes very little sense, though your logic might have a better idea of the access pattern than PostgreSQL does. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@xxxxxxxxxxxxx Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461