Thread: rtree: improve performance, tuple killing
This patch makes some improvements to the rtree index implementation: (1) Keep a pin on the scan's current buffer and mark buffer. This avoids the need to do a ReadBuffer() for each tuple produced by the scan. (2) Convert a ReleaseBuffer() ; ReadBuffer() pair into ReleaseAndReadBuffer(). Surely not a huge win, but it saves a lock acquire/release... (3) Remove a bunch of duplicated code in rtget.c; make rtnext() handle both the "initial result" and "subsequent result" cases. (4) Add support for index tuple killing (5) Remove rtscancache(): it is dead code, for the same reason that gistscancache() is dead code (an index scan ought not be invoked with NoMovementScanDirection). The end result is about a 10% improvement in index scan performance, according to contrib/rtree_gist/bench. These changes (with the exception of #2) are analogous to changes I've already made for GiST (it's clear that GiST was started as a fork of rtree). I'm not hugely interested in further improvements to rtree; I just did this stuff because it is low-hanging fruit and I've already made the same changes for GiST. -Neil
Attachment
Neil Conway <neilc@samurai.com> writes: > This patch makes some improvements to the rtree index implementation: Please hold this for the 8.1 cycle. I think we are past the time for non-bug-fix changes in the 8.0 release. regards, tom lane
On Tue, 2004-11-23 at 23:40 -0500, Tom Lane wrote: > Please hold this for the 8.1 cycle. I think we are past the time for > non-bug-fix changes in the 8.0 release. Sorry, I should have mentioned that explicitly: I have (and had) no intention of applying this for 8.0. -Neil
Barring any objections, I intend to apply this patch tomorrow. The patch, as well as the original -patches email, are included below. -Neil On Wed, 2004-11-24 at 11:15 +1100, Neil Conway wrote: > This patch makes some improvements to the rtree index implementation: > > (1) Keep a pin on the scan's current buffer and mark buffer. This avoids > the need to do a ReadBuffer() for each tuple produced by the scan. > > (2) Convert a ReleaseBuffer() ; ReadBuffer() pair into > ReleaseAndReadBuffer(). Surely not a huge win, but it saves a lock > acquire/release... > > (3) Remove a bunch of duplicated code in rtget.c; make rtnext() handle > both the "initial result" and "subsequent result" cases. > > (4) Add support for index tuple killing > > (5) Remove rtscancache(): it is dead code, for the same reason that > gistscancache() is dead code (an index scan ought not be invoked with > NoMovementScanDirection). > > The end result is about a 10% improvement in index scan performance, > according to contrib/rtree_gist/bench. > > These changes (with the exception of #2) are analogous to changes I've > already made for GiST (it's clear that GiST was started as a fork of > rtree). I'm not hugely interested in further improvements to rtree; I > just did this stuff because it is low-hanging fruit and I've already > made the same changes for GiST.
Attachment
On Tue, 2005-01-18 at 16:43 +1100, Neil Conway wrote: > Barring any objections, I intend to apply this patch tomorrow. Applied. -Neil