duckdb/duckdb
Configuration
DuckDB is configured at three levels: engine-wide (DBConfig), per-connection (ClientContext overrides), and per-session via PRAGMA/SET. The full list of settings is auto-generated from src/common/settings.json.
Looking up settings
SELECT * FROM duckdb_settings(); -- everything available
SELECT * FROM duckdb_settings() WHERE name LIKE '%memory%';
SELECT current_setting('threads');
PRAGMA threads; -- equivalent
SET threads = 4; -- override for this session
RESET threads; -- restore defaultSome settings are global only (must be set on the DBConfig before opening), others are per-session. The scope column in duckdb_settings says which.
Frequently used settings
| Setting | Default | What it controls |
|---|---|---|
memory_limit |
80% of system memory | Buffer manager budget. Spills when exceeded. |
threads |
number of CPUs | Worker pool size for TaskScheduler. |
temp_directory |
platform default | Where spill files go. |
default_block_size |
256 KB | Block size for new databases (immutable per database). |
wal_autocheckpoint |
16 MB | WAL size that triggers a checkpoint. |
force_compression |
empty | Force a specific compression codec; otherwise auto. |
enable_progress_bar |
off | CLI progress bars. |
enable_profiling |
off | none / query_tree / json. |
profile_output |
stdout | Path for the profile dump. |
default_collation |
empty | Default string collation (with the ICU extension). |
TimeZone |
system | Active time zone (with ICU). |
IntervalStyle |
postgres | postgres / iso_8601. |
enable_object_cache |
true | Reuse parsed parquet metadata across queries. |
autoload_known_extensions |
true | Auto-load extensions for known URIs / functions. |
allow_unsigned_extensions |
false | Permit unsigned .duckdb_extension files. |
errors_as_json |
false | Emit error data as JSON for structured logging. |
disabled_optimizers |
empty | Comma-separated optimizer-pass names to disable. Useful for debugging. |
arrow_large_buffer_size |
false | Force Arrow conversions to use 64-bit offsets. |
enable_logging |
false | Turn on the structured logger (see systems/main). |
log_query_path |
empty | If non-empty, append every executed query to the file. |
The full list (~200 entries) lives in src/common/settings.json. Every entry has a corresponding setter/getter generated into src/main/settings/.
Pragmas
Some configuration is exposed only as PRAGMA (not SET):
| Pragma | Effect |
|---|---|
PRAGMA force_checkpoint; |
Flush WAL into the database file now. |
PRAGMA enable_progress_bar; |
Enable the progress bar this session. |
PRAGMA enable_object_cache; |
Toggle the parsed-metadata cache. |
PRAGMA threads = 4; |
Synonym for SET threads = 4. |
PRAGMA database_size; |
Print database size info. |
PRAGMA show_databases; |
List attached databases. |
PRAGMA show_tables; |
List tables in the current schema. |
PRAGMA show_tables_expanded; |
Same plus columns. |
PRAGMA functions; |
List registered functions. |
PRAGMA version; |
DuckDB version + release date. |
PRAGMA platform; |
Compiled platform string. |
Pragmas live in src/function/pragma/.
Configuration via the C API
duckdb_database db;
duckdb_config config;
duckdb_create_config(&config);
duckdb_set_config(config, "memory_limit", "4GB");
duckdb_set_config(config, "threads", "4");
duckdb_open_ext(":memory:", &db, config, NULL);
duckdb_destroy_config(&config);Implementation: src/main/capi/config-c.cpp, config_options-c.cpp.
Per-connection overrides
ClientContext holds per-connection setting overrides. Connection::Query("SET threads=8") only affects the current connection. The C++ binding is Connection::SetConfig.
Storage settings (immutable)
A handful of settings are baked into the database file at creation and cannot be changed afterward:
| Setting | Effect |
|---|---|
default_block_size |
Block size for the file. |
default_string_encoding |
UTF-8 vs ASCII. |
encryption_key |
If set, the database is encrypted on disk. |
These are consumed by StorageManager during CREATE DATABASE (i.e., the first open of a new file).
Logging and observability
DuckDB ships a structured logger:
SET enable_logging = true;
SET log_query_path = '/tmp/queries.log';The logger is implemented in src/logging/; its C interface is in src/main/capi/logging-c.cpp. See how-to-contribute/debugging.
Where to look
src/common/settings.json— source of truth for settings.src/main/settings/— generated setter/getter files.src/main/config.cpp—DBConfigimplementation.scripts/generate_settings.py— generator.
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.