Search code examples
c++lmdb

LMDB Seek (move the cursor) without read


I would like to know whether it is possible to move the cursor forward for, say, n positions without retrieving data at the same time (i.e. lowering i/o load).

I am aware of mdb_cursor_get but it seems to retrieve the data from disk at each call in combination with MDB_NEXT.

Your help is very much appreciated!


Solution

  • Pass a NULL pointer for the data argument and it will skip the retrieval. In practice, for small records that all fit on a leaf page, there will be no performance difference since this is mmap'd and zero-copy.