Search code examples
treeerlanglinked-listb-tree

B+ Tree Data Structure in Erlang


Is there any open source known implementation of the B+ Tree Data Structure in Erlang ?


Solution

  • I would definitely recommend looking into the eleveldb application if you really need a B+ tree. The point being that you want to store data in leaves of a tree, off-line on disk, as this is where B+-trees are normally an option. There is also a variant in pure Erlang of LevelDB called hanoidb which also is pretty nice, written by Kresten Krab Thorup. Same area of use.

    If you need in-memory storage, you should be looking at either ETS or Mnesia (the latter for distribution). In Erlang these tend to be the fastest solutions as you have the advantage of never hitting the disk. It is especially true if you can do standard key/value lookups on your data with no need to run inside the transactional context in Mnesia (doing dirty-reads). Typical lookup speed is then 5-10 nanoseconds.