Skip to content

Feature request: multi_get() for batch key lookupsΒ #229

@lveillard

Description

@lveillard

Use Case

I'm building an embedded graph database (BlitzStore) on top of fjall. A common operation is fetching multiple units by ID after an index scan:

// Current: N individual gets
let mut units = Vec::with_capacity(ids.len());
for &id in ids {
    if let Some(unit) = partition.get(id.to_be_bytes())? {
        units.push(unit);
    }
}

Proposed API

// Batch lookup
let results: Vec<Option<Slice>> = partition.multi_get(&[key1, key2, key3])?;

Expected Benefits

Based on RocksDB benchmarks, batch lookups can be 2-3x faster than individual gets due to:

  • Shared bloom filter checks across keys
  • Better cache locality
  • Reduced per-call overhead

Workaround

For contiguous IDs we use range scans, but for non-contiguous IDs (common after filtering) we fall back to N individual gets.

Priority

This is the only missing feature we identified after reviewing fjall 3.0 - everything else we needed (contains_key, .rev(), approximate_len, OCC transactions) is already there. Great work on 3.0! πŸŽ‰

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions