0

I have a requirement where I only do point lookups but I also need to iterate but don't have to be in any specific order. I used OptimizeForPointLookup and used the iterator API and everything seems to work fine. However, the rocksdb code is documented with the following in options.h against the OptimizeForPointLookup api.

// Use this if you don't need to keep the data sorted, i.e. you'll never use // an iterator, only Put() and Get() API calls

Is there something I am missing? Interestingly the iteration also seems to be happening in a sorted order.

Siva
  • 1,096
  • 7
  • 20

1 Answers1

2

OptimizeForPointLookup() API makes the GET/PUT operation faster by creating a BLOOM FILTER and setting the Index type to kHashSearch. As the name suggest, kHashSearch creates hash over the keys and makes point lookups faster.

For normal iterator operation, the index type is set to kBinarySearch. RocksDB by default, inserts data into memtable in sorted order. Optimizing for Point Lookups doesnot affect this insert behaviour of rocksDB.