Options reference
Every database-wide and per-keyspace option with its default, and the presets for point lookups, write-heavy keyspaces and bulk loads.
Options are validated when built. A value out of range is refused with
Error::InvalidOptions, naming the option. The full list, with every bound, is
in the API reference.
Database options
Set through DbOptions::builder().
| Option | Default | What it sets |
|---|---|---|
create_if_missing | true | create the database when the path holds none |
error_if_exists | false | refuse to open a database that already exists |
storage | StorageMode::Os | files on disk, or Memory (DbOptions::in_memory()) |
wal_segment_bytes | 64 MiB | size at which a log segment is closed and the next started |
wal_recovery | PointInTime | what opening does with a damaged log end |
block_cache_bytes | 512 MiB | block cache shared by every keyspace; zero disables it |
background_threads | 4 | threads running flushes and compactions |
compaction_bytes_per_second | 0 (unpaced) | pace of compaction output |
delayed_write_bytes_per_second | 16 MiB/s | pace of writes while slowed down |
serializable_transactions | false | allow Isolation::Serializable |
total_memtable_bytes | 0 (no ceiling) | cap on the newest in-memory tables of every keyspace together |
max_open_files | 0 (no bound) | table files kept open at once |
max_manifest_bytes | 64 MiB | size past which the manifest is rewritten; bounds open time |
statistics | false | count tickers and histograms |
encryption(provider, key_id) | off | encryption at rest |
encryption_cipher | by processor | pin AES-256-GCM or ChaCha20-Poly1305 |
default_keyspace | defaults | options of the default keyspace |
keyspace(name, options) | — | name a keyspace to open |
create_missing_keyspaces | false | add named keyspaces the database does not hold |
Keyspace options
Set through KeyspaceOptions::builder().
| Option | Default | What it sets |
|---|---|---|
memtable_bytes | 64 MiB | in-memory table size before it is frozen |
max_immutable_memtables | 2 | frozen tables that may wait for a flush |
block_bytes | 4 KiB | data block size before compression |
block_restart_interval | 16 | keys between two whole keys in a block |
bloom_bits_per_key | 10 | bloom filter size; zero writes no filter |
compression | Lz4 | None, Lz4, Snappy, Zstd or Deflate { level } |
bottommost_compression | None (same as above) | a separate codec for the bottom level |
compaction | Leveled | Leveled, universal() or fifo() |
level0_compaction_trigger | 4 | level-0 tables that start a compaction |
level0_slowdown_trigger | 20 | level-0 tables at which writes slow down |
level0_stop_trigger | 36 | level-0 tables at which writes stop |
soft_pending_compaction_bytes | 64 GiB | compaction debt at which writes slow down |
hard_pending_compaction_bytes | 256 GiB | compaction debt at which writes stop |
level_base_bytes | 256 MiB | target size of the first level below level 0 |
level_size_multiplier | 10 | growth from one level to the next |
target_file_bytes | 64 MiB | size at which compaction closes an output table |
max_compactions | 4 | compactions of the keyspace at once |
max_subcompactions | 4 | parallel parts of one compaction |
disable_auto_compactions | false | no compaction unless asked for, for bulk loads |
Presets
| Preset | For | Sets |
|---|---|---|
KeyspaceOptions::point_lookup() | mostly point reads | 16 bloom bits per key, about 0.1 % false positives |
KeyspaceOptions::write_heavy() | mostly writes | 256 MiB in-memory tables, up to four waiting for a flush |
KeyspaceOptions::bulk_load() | one large load | 512 MiB in-memory tables, up to six waiting, 64 KiB blocks |
Start from a preset and adjust it with to_builder().
Per-write, per-read, per-transaction
WriteOptions—durability,no_slowdown. See Writes and durability.ReadOptions—verify_checksums,fill_cache,lower_bound,upper_bound. See Reads and snapshots.TransactionOptions—isolation. See Transactions.