I use GiST indexes pretty often, so I understand their performance characteristics and the API that they use and why you'd want one. What I don't understand is, under the covers, how exactly do they work? I'm looking for an explanation of the underlying data structures and algorithms behind it.
If I wanted to implement my own GiST index, how would I do that? Ideally I'd love to see sample code of a super-simple non-optimized version which I couldn't find anywhere on the web, since that would help me understand it best.