Dear Howard,

thank you for your quick reply.
Do you see the chance to add such a function with minimal effort?
My alternative would be to implement an additional data structure like HLL or counting bloom filters which also require space and processing time for maintenance of the index.

Best regards,
Ken Wenzel


Von: Howard Chu <hyc@symas.com>
Gesendet: Freitag, 17. Juni 2022, 19:17
An: Ken Wenzel <kenwenzel@gmx.net>; openldap-technical@openldap.org <openldap-technical@openldap.org>
Betreff: Re: LMDB: Estimate number of elements between two keys

Ken Wenzel wrote: > Dear OpenLDAP-Community, > >   > > is it possible to compute a rough estimate of the number of elements between two given keys for an LMDB database? There's no feature in LMDB to do this, no. > > Currently, I scan the first 1000 keys and extrapolate the count based on the average distance of the keys. > > Maybe it is also possible to use some information about the common b-tree pages that are shared by both keys? > > We need this functionality for query optimization within RDF4J. > >   > > Thank you for your support and best regards, > > Ken Wenzel > >   > -- -- Howard Chu CTO, Symas Corp. http://www.symas.com Director, Highland Sun http://highlandsun.com/hyc/ Chief Architect, OpenLDAP http://www.openldap.org/project/