question about BabuDB - batch reading

15 views
Skip to first unread message

Liu, Jing Min

unread,
Jan 28, 2013, 12:25:51 PM1/28/13
to bab...@googlegroups.com

Hi,

 

I am trying BabuDB to see if it meets my project requirement.

 

Now that I learned that BabuDB can perform batch insert using insert group. But I am wondering if it supports batch reading. The Database. prefixLookup() or rangeLookup() seems to be able to help achieve this goal. But I am not sure about this and how to use them.

 

Could you please give me some advice?

 

Thank you,

Jamie

Jan Stender

unread,
Jan 28, 2013, 5:33:52 PM1/28/13
to bab...@googlegroups.com
Dear Jamie,

it depends on what exactly you refer to as "batch reading". Prefix and range lookups allow to retrieve a contiguous range of records in O(log(n)) + k steps, being n the total number of records in your index and k the number of consecutive records to be retrieved (by contrast, it would take k*O(log(n)) steps to retrieve each record individually). "Consecutive" in this context refers to the ordering of keys on your index. By default, it is lexicographical i.e., a byte array like [1, 2] takes precedence over [1, 3], which in turn takes precedence over [1, 3, 2], etc. Accordingly, a prefix lookup on [1, 3] would return an iterator containing all records with keys starting with [1, 3], such as [1, 3, 7], [1, 3, 33, 74] or [1, 3, 92, 5, 6]. Similarly, a range lookup returns all keys from the first key of the range, inclusively, to the last key, exclusively; starting with [1, 2] and ending with [1, 5], it could thus return records with keys like [1, 2], [1, 3, 8, 28] or [1, 4, 8].

I hope this sheds a little light on how prefix and range lookups work.

Best regards,
Jan

Reply all
Reply to author
Forward
0 new messages