MDB_REVERSEKEY top-level constant
int
const MDB_REVERSEKEY
Stores key/data pairs in reverse byte order.
When used:
- Keys are stored in reverse byte order
- Can improve performance for certain key types
- Useful for string keys with significant trailing bytes
Common usage scenarios:
- String-based keys
- Custom sorting requirements
- Performance optimization
Example scenario:
Normal string comparison: "abc1" < "abc2" < "abd1"
With MDB_REVERSEKEY: Internally stored and compared as: "1cba" < "1dba" < "2cba"
Usage example:
await db.init(path, flags: LMDBFlagSet()..add(MDB_REVERSEKEY));
await db.putUtf8(txn, "abc1", "value1");
await db.putUtf8(txn, "abc2", "value2");
await db.putUtf8(txn, "abd1", "value2");
Performance:
- May improve string key handling
- Affects key comparison operations
- Consider key access patterns
Implementation
const MDB_REVERSEKEY = bindings.MDB_REVERSEKEY;