Search code examples
databaseconcurrencynosqlb-treesnapshot-isolation

Implementing ranged queries with B+trees and snapshot isolation


I'm developing a new NoSQL database server product. Are there any papers on how to implement range queries on clustered B+ trees that uses snapshot isolation?


Solution

  • I have written a couple of B+tree implementations. For a range query you move a cursor to the key with the lower bound of the range, then "move right" till you reach the upper bound. A B+-link tree (which has left/right-pointers between the leaf nodes) makes this extremely simple.

    I have, however, never implemented snapshot isolation. I think this strongly depends on your isolation algorithm. If you use shadow pages (where you create copies of the modified pages for each transaction) then you have to check if a shadow page exists before "moving right" along the leaf nodes.