Skip to content

The effect of opening a large number of (sub) databases on performance #216

Answered by kriszyp
azarenkovgd asked this question in Q&A
Discussion options

You must be logged in to vote

The maximum number of databases does affect performance, according to the LMDB docs:

Currently a moderate number of slots are cheap but a huge number gets expensive: 7-120 words per transaction, and every mdb_dbi_open() does a linear search of the opened slots.

http://www.lmdb.tech/doc/group__mdb.html#gaa2fc2f1f37cb1115e733b62cab2fcdbc
(this function is mapped maxDbs)
However, I think it requires a very large number before there is any noticeable impact (probably tens of thousands). I think this is stored in a 32-bit value, so might be a 4G limit on number, but almost certainly would run into performance issues before then.
Generally each root database is going to be much more expensive…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@azarenkovgd
Comment options

Answer selected by azarenkovgd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants