minima icon indicating copy to clipboard operation
minima copied to clipboard

Effective Multi-Get

Open decanus opened this issue 5 years ago • 0 comments

Problem

Right now if I want to get multiple keys from the tree, I need to call the search function multiple times. If I want to do the set notation based queries as mentioned in #4, then an effective way to query multiple trees would be useful. So that in a single go, we step by step find relevant keys.

Possible Solution

The way that searching in a B-Tree works already gives us a solution, we simple need to change the way we traverse a tree. When receiving an MultiGet request, we sort the keys in this request, upon that we go by the first key, find the closest etc etc and traverse in groups by going section by section of our request.

Lets say my tree looks as follows:

  2|4
/  |  \
1  3  8

And we query [1, 3, 8, 12, 13]

We first go to the first section of the tree, and pick up one, then we go to the second and pick up 3, we realize there is nothing else in this section therefore we move back up and pick 12, 13 from the next relevant branch.

decanus avatar Jul 06 '20 15:07 decanus