[Date Prev][Date Next] [Chronological] [Thread] [Top]

Accessing random rows from LMDB



Hello Everyone,

I am new to LMDB. I have couple of questions,

1) Is there anyway that I can find the total number of records in LMDB.
2) Can I access all the rows from LMDB randomly instead of sequentially. For example, if there are 10 rows in LMDB as shown below,

Key, Value
K1, V1
K2, V2
K3, V3
K4, V4
K5, V5

I want to access it randomly, something like shown below

Key, Value
K3, V3
K5, V5
K4, V4
K2, V2
K1, V1

I know that it is better to read sequentially from LMDB and then later randomize the records. But I have around 1 million records in LMDB, I cant upload entire data to memory at once. I am planning to read data batch wise into memory and perform some operation on it. So, I am wondering, is there anyway that I can read the data randomly from LMDB directly.

Looking forward to hear from you

-
Regards,
Sravan