Database B-trees, II

In my previous post I have compared two database B-trees for in-memory insertions. That is, I have looked at the time it took the two B-trees to populate from zero, with no disk writing involved.

In this post I’ll be looking at the in-memory query time. All data is in memory, no disk reading is needed. The B-trees are the same from the previous post, the classical database B-tree (CDB) from LMDB and the nonblonde B-tree. LMDB wants the read operations to be in a transaction — all are in the same one.

LMDB is optimized for querying — or so its description claims. nonblonde isn’t. In truth, I don’t know what “optimized for querying” is supposed to mean for LMDB. I assume the design choices were skewed toward querying. nonblonde cares for editing just as it does for querying. One was not sacrificed for the other.

In this test I am querying all the keys present in the table/database, in random order (incidentally, the insertion order).

Key countCDBnonblonde
1048576.776s.574s
20971521.731s1.415s
41943043.808s3.054s
PKD
Key countCDBnonblonde
1048576.877s.609s
20971521.92s1.365s
41943044.15s3.075s
ENW
Key countCDBnonblonde
10485761.37s.806s
20971523.2s1.822s
41943047.05s4.2s
URL

For the last run, the LMDB database size on disk is 1,030,463,488 + 8,192 bytes (two files). The nonblonde database is 111,123,456 + 117,181 bytes (also two files).

The in-memory querying is where LMDB is supposed to shine. LMDB is the “lightning” database — the “lightning memory” database. LMDB is, according to the publisher, “extraordinarily fast”. It “has the read performance of a pure in-memory database.” Maybe not.

One thought on “Database B-trees, II

Leave a comment