Block-Based Table Options
BlockBasedTableOptions
Index Types
IndexType
Space-efficient index optimized for binary search.
IndexType
Hash index for prefix lookups when prefix_extractor is provided.
IndexType
Two-level index with both levels using binary search. Second level blocks use block cache.
IndexType
Binary search index that also contains the first key of each block, allowing iterators to defer reading blocks.
Table Factory Creation
NewBlockBasedTableFactory
const BlockBasedTableOptions&
Configuration for block-based tables.
TableFactory*
Returns a pointer to the created table factory.
NewPlainTableFactory
NewCuckooTableFactory
Cache Configuration
Block Cache
std::shared_ptr<Cache>
Cache for data blocks. If nullptr and no_block_cache is false, a 32MB internal cache is created.
Caching Index and Filter Blocks
bool
When false, index/filter blocks are pre-loaded during table initialization. When true, they use the block cache.
Checksum Types
ChecksumType
Default. Fast and high-quality checksum. Supported since RocksDB 6.27.
ChecksumType
CRC32c checksum with hardware acceleration on x86.
Block Size and Compression
block_size
uint64_t
Approximate size of uncompressed data packed per block. Actual disk read size may be smaller if compression is enabled.
block_restart_interval
int
Number of keys between restart points for delta encoding. Minimum value is 1.
Filter Configuration
filter_policy
std::shared_ptr<const FilterPolicy>
Filter policy to reduce disk reads. Use NewBloomFilterPolicy() for most applications.
whole_key_filtering
bool
If true, place whole keys in the filter (not just prefixes). Must be true for efficient point lookups.
partition_filters
bool
Use partitioned filters. Requires kTwoLevelIndexSearch. Filter partition blocks use block cache even when cache_index_and_filter_blocks=false.
Format Version
uint32_t
Schema version for table files. Default is 7 for latest features. Version 6 adds checksum protection, version 5 adds faster Bloom filters.
Example
Advanced Options
Metadata Cache Options
Read Amplification Measurement
uint32_t
Enable read amplification statistics. Creates a bitmap to track which parts of blocks are actually read. Must be a power of 2. Default 0 (disabled).