Docs
  • 0.0.2latest

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().

OptionDefaultWhat it sets
create_if_missingtruecreate the database when the path holds none
error_if_existsfalserefuse to open a database that already exists
storageStorageMode::Osfiles on disk, or Memory (DbOptions::in_memory())
wal_segment_bytes64 MiBsize at which a log segment is closed and the next started
wal_recoveryPointInTimewhat opening does with a damaged log end
block_cache_bytes512 MiBblock cache shared by every keyspace; zero disables it
background_threads4threads running flushes and compactions
compaction_bytes_per_second0 (unpaced)pace of compaction output
delayed_write_bytes_per_second16 MiB/space of writes while slowed down
serializable_transactionsfalseallow Isolation::Serializable
total_memtable_bytes0 (no ceiling)cap on the newest in-memory tables of every keyspace together
max_open_files0 (no bound)table files kept open at once
max_manifest_bytes64 MiBsize past which the manifest is rewritten; bounds open time
statisticsfalsecount tickers and histograms
encryption(provider, key_id)offencryption at rest
encryption_cipherby processorpin AES-256-GCM or ChaCha20-Poly1305
default_keyspacedefaultsoptions of the default keyspace
keyspace(name, options)—name a keyspace to open
create_missing_keyspacesfalseadd named keyspaces the database does not hold

Keyspace options

Set through KeyspaceOptions::builder().

OptionDefaultWhat it sets
memtable_bytes64 MiBin-memory table size before it is frozen
max_immutable_memtables2frozen tables that may wait for a flush
block_bytes4 KiBdata block size before compression
block_restart_interval16keys between two whole keys in a block
bloom_bits_per_key10bloom filter size; zero writes no filter
compressionLz4None, Lz4, Snappy, Zstd or Deflate { level }
bottommost_compressionNone (same as above)a separate codec for the bottom level
compactionLeveledLeveled, universal() or fifo()
level0_compaction_trigger4level-0 tables that start a compaction
level0_slowdown_trigger20level-0 tables at which writes slow down
level0_stop_trigger36level-0 tables at which writes stop
soft_pending_compaction_bytes64 GiBcompaction debt at which writes slow down
hard_pending_compaction_bytes256 GiBcompaction debt at which writes stop
level_base_bytes256 MiBtarget size of the first level below level 0
level_size_multiplier10growth from one level to the next
target_file_bytes64 MiBsize at which compaction closes an output table
max_compactions4compactions of the keyspace at once
max_subcompactions4parallel parts of one compaction
disable_auto_compactionsfalseno compaction unless asked for, for bulk loads

Presets

PresetForSets
KeyspaceOptions::point_lookup()mostly point reads16 bloom bits per key, about 0.1 % false positives
KeyspaceOptions::write_heavy()mostly writes256 MiB in-memory tables, up to four waiting for a flush
KeyspaceOptions::bulk_load()one large load512 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