Hi,
I have a database with about 1 million integer keys. Now I want to append a lot
of small values (each 3 bytes)
to random keys very often (tens of millions of times). How do I insert into the
database the fastest?
Currently I am trying the following setup, but I wonder if that is optimal,
because I see a decrease
in indexing speed after about 500000 random writes (here appends):
- I have split the whole key range into 16 databases (each within a different
lmdb environment), so each range-db holds
about 65000 keys
- I open each range-db with the flags: MDB_APPENDDUP | MDB_INTEGERKEY |
MDB_INTEGERDUP | MDB_DUPSORT
- then when I want to append 3 bytes to the value of a key, I use the following
call:
res = mdb_put( txn[dbnumber], db[dbnumber], &k, &v, MDB_APPENDDUP );
Thank you for your help!
-Tom