Expand description
Optimized Range Scan with O(log n + k) Asymptotics
This module replaces the O(n) full-table scan with proper index utilization:
§Optimizations Applied
- Sparse Index Lookup: O(log n) binary search in level metadata
- Block-Level Skipping: Only read blocks that overlap [start, end]
- Version Filtering: Skip blocks with no visible versions
- Bloom Filter Pre-check: Skip SSTables that definitely don’t contain range
- K-way Merge with Tournament Tree: O(k log m) merging where m = levels
§Complexity Analysis
- Index lookup: O(log n) per level
- Block reads: O(k / block_size) where k = result count
- Merge: O(k log m) where m = number of sources
- Total: O(log n + k log m)
Compare to naive scan: O(n) where n = total entries
Structs§
- File
Range - File metadata for range-based file selection
- Level
Files - Level metadata for file selection
- Range
Scanner - Optimized range scanner
- Scan
Config - Range scan configuration
- Scan
Stats - Scan statistics
- Tournament
Tree - Tournament tree for efficient k-way merge
- Versioned
Entry - A key-value pair with version metadata
Traits§
- Entry
Source - Source of entries for merging
Functions§
- select_
files_ for_ range - Helper to select files for a range scan
Type Aliases§
- Timestamp
- Snapshot timestamp for MVCC visibility