MDBX Containers
Loading...
Searching...
No Matches
Database Configuration

This page describes each option of the mdbxc::Config class and how it affects the resulting MDBX environment. These settings are passed to mdbxc::Connection when opening the database and translate directly to MDBX API calls or flags.

  • pathname: Location of the database files. If relative_to_exe is true and the path is relative, it is resolved against the directory of the running executable.
  • size_lower, size_now, size_upper, growth_step, shrink_threshold**, page_size: Parameters of mdbx_env_set_geometry that control the file size limits, growth step and page size. Use them to preallocate space or restrict database growth. See the MDBX manual for details: https://libmdbx.dqdkfa.ru/group__c__settings.html#ga79065e4f3c5fb2ad37a52b59224d583e
  • max_readers: Maximum number of concurrent readers set via mdbx_env_set_maxreaders. Increase this if many threads or processes need parallel read transactions.
  • max_dbs: Upper bound for the number of named sub-databases configured via mdbx_env_set_maxdbs. Set this to the total tables you expect.
  • read_only: When true adds MDBX_RDONLY so the environment is opened in read-only mode.
  • readahead: If false adds MDBX_NORDAHEAD, disabling OS readahead and potentially improving random I/O performance.
  • no_subdir: Adds MDBX_NOSUBDIR so the data and lock files are stored next to each other rather than inside a directory.
  • sync_durable: Adds MDBX_SYNC_DURABLE forcing an fsync after each commit for maximum durability at the cost of latency.
  • writemap_mode: Adds MDBX_WRITEMAP to map pages writable. This can speed up modifications but may increase virtual memory usage and requires reliable syncing.
  • relative_to_exe: When set, resolves relative paths as described for pathname.

Tune these options to balance performance and durability. Combining writemap_mode with sync_durable mimics MDBX's default safe mode, while disabling sync_durable trades safety for throughput. For more guidance see the official MDBX documentation: https://libmdbx.dqdkfa.ru/.