[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Fast key range iteration
- To: Александр Киранов <xhaskx@gmail.com>
- Subject: Re: Fast key range iteration
- From: Arto Bendiken <arto@bendiken.net>
- Date: Tue, 5 May 2015 08:46:32 +0200
- Cc: OpenLDAP technical mailing list <openldap-technical@openldap.org>
- In-reply-to: <CANG+hL0DYTmpvs6D9-pU+2tHg-D+m4EthmsaJp=awKOSnt2_qg@mail.gmail.com>
- References: <CANG+hL0DYTmpvs6D9-pU+2tHg-D+m4EthmsaJp=awKOSnt2_qg@mail.gmail.com>
On Mon, May 4, 2015 at 9:31 PM, Александр Киранов <xhaskx@gmail.com> wrote:
> Is there a way to iterate with all key-value pairs in LMDB database, where
> all keys is in specified range?
> I'm trying to use mdb_cursor_get() with MDB_SET_RANGE to search first pair.
> Then I see only one way - use mdb_cursor_get() with MDB_NEXT and compare key
> by memcmp().
> But it seems absolutely not effective.
>
> Is there another solution for my task?
Instead of memcmp(), you'd probably want to use mdb_cmp() for the key
comparison:
http://symas.com/mdb/doc/group__mdb.html#gaba790a2493f744965b810efac73bac0e
--
Arto Bendiken | @bendiken | http://ar.to