This patch makes some improvements to the rtree index implementation:
Neil Conway <neilc@samurai.com>
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. Since ReadBuffer() is expensive, this is a significant win. (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 rtree index scan perf, according to contrib/rtree_gist/bench.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/rtree/rtget.c | modified | +102 −139 |
| src/backend/access/rtree/rtree.c | modified | +3 −7 |
| src/backend/access/rtree/rtscan.c | modified | +41 −2 |
| src/include/access/rtree.h | modified | +11 −6 |