On 9/14/2013 12:44 PM, Howard Chu wrote:
Ah totally forgot about that, it's been a couple years since I
looked
inside that code. LMDB updates record counts on every write op so
returning the count is zero-cost. (Ironically we don't use this fact
to optimize filter evaluation order in OpenLDAP. Probably should...)
Also due to the fact that writing a leaf page requires every page up
to the root to be updated (copy-on-write design), updating the counts
also comes "for free" since the root page had to be updated anyway.
(Or put another way, LMDB writes are already slow by design; updating
the counters doesn't make them any slower.)
BDB has a similar feature. We're just having a little trouble finding it ;)