> It seems that it contradicts the very idea of your patch, so probably we > should look for other ways to optimize this use-case. > Maybe this restriction can be relaxed for write only tables, that never > have to reread the page because of visibility, or something like that. > Also we probably can add to IndexScanDescData info about expected number > of tuples, to allow index work more optimal > and avoid the overhead for other loads.=
The idea of the patch is exactly to relax this limitation. I forgot to update that README file though. The current implementation of the patch should be correct like this - that's why I added the look-back code on the page if the tuple couldn't be found anymore on the same location on the page. Similarly, it'll look on the page to the right if it detected a page split. These two measures combined should give a correct implementation of the 'it's possible that a scan stops in the middle of a page' relaxation. However, as Peter and Tom pointed out earlier, they feel that the performance advantage that this approach gives, does not outweigh the extra complexity at this time. I'd be open to other suggestions though. > That's true. It took me quite some time to understand that existing code > is correct. > There is a comment for the structure's field that claims that > BufferIsValid is the same that BufferIsPinned in ScanPos context. > Attached patch contains some comments' updates. Any suggestions on how > to improve them are welcome. I'll have a look tomorrow. Thanks a lot for writing this up! -Floris