This is an updated version of the GiST patch I posted a few months ago.
As before, it makes the following changes:
- ensure that all user-supplied GiST methods are invoked in a
short-lived memory context. Therefore, explicitly releasing palloc'ed
memory via pfree is unnecessary (and probably results in worse
performance). This lowers the barrier to entry for writing GiST-based
indexes.
- change GiST so that we keep a pin on a scan's current buffer, rather
than doing ReadBuffer() for each tuple produced by the scan.
ReadBuffer() is relatively expensive, so this is a win.
- the previous change makes it pretty easy to implement dead tuple
killing for GiST (which means that all the builtin indexes now do this).
The patch also cleans up a lot of pretty ugly code in GiST. AFAIK all
existing GiST-based indexes should continue to work unchanged -- the
regression tests for all the contrib/ indexes pass, at any rate.
Barring any objections I'll apply this to HEAD tomorrow or the day after.
-Neil