Configuration
ScramDB is configured via environment variables or a configuration file.
Environment Variables
Memory
| Variable | Default | Description |
|---|---|---|
SCRAMDB_MEMORY_LIMIT | 4G | Maximum memory for buffer pool and execution |
SCRAMDB_BUFFER_POOL_SIZE | Auto | Buffer pool size (defaults to 70% of memory limit) |
Execution
| Variable | Default | Description |
|---|---|---|
SCRAMDB_WORKERS | Auto | Number of parallel worker threads (default: CPU cores) |
SCRAMDB_MORSEL_SIZE | 4MB | Base morsel size for parallel work units |
SCRAMDB_JIT_ENABLED | true | Enable JIT compilation |
SCRAMDB_JIT_THRESHOLD | 1 | Executions before triggering JIT |
Storage
| Variable | Default | Description |
|---|---|---|
SCRAMDB_DATA_DIR | /var/lib/scramdb | Data directory |
SCRAMDB_WAL_DIR | {data_dir}/wal | WAL directory |
SCRAMDB_WAL_SYNC | true | Fsync WAL writes |
SCRAMDB_PAGE_SIZE | 16384 | Page size in bytes (16KB) |
Network
| Variable | Default | Description |
|---|---|---|
SCRAMDB_PORT | 5432 | PostgreSQL wire protocol listen port |
SCRAMDB_HOST | 0.0.0.0 | Listen address |
SCRAMDB_MAX_CONNECTIONS | 256 | Maximum concurrent connections |
Logging
| Variable | Default | Description |
|---|---|---|
SCRAMDB_LOG_LEVEL | info | Log level: trace, debug, info, warn, error |
Config File
ScramDB also reads from scramdb.toml in the data directory:
[memory]
limit = "8G"
[execution]
workers = 8
jit_enabled = true
[storage]
data_dir = "/var/lib/scramdb"
wal_sync = true
[network]
port = 5432
max_connections = 256
Environment variables take precedence over config file values.