Switches a Rducks-enabled DuckDB connection to an inproc_concurrent
execution plan for subsequent scalar-UDF registrations and updates the native
runtime backend. This backend preserves R's thread discipline: DuckDB
worker-side scalar-UDF callbacks submit chunk requests to an extension-owned
queue, and the recorded main R thread drains the queue and performs all R API
work. This is a same-process scheduling mode, not a performance promise; R
function calls are still serialized on the main R thread.
Arguments
- con
A
duckdb_connectionalready enabled withrducks_enable().- threads
Optional positive integer to set with
PRAGMA threadsbefore enabling the in-process backend. UseNULLto leave unchanged.- external_threads
Optional positive integer to set with
SET external_threadsbefore enabling the in-process backend. UseNULLto leave unchanged. For actual DuckDB worker concurrency, keep this smaller thanthreads(for examplethreads = 4, external_threads = 1).
Details
This is a helper for the direct in-process queue. New code can call
rducks_set_execution_plan()
directly with rducks_execution_plan("inproc"). Select the plan
before registering scalar UDFs whose reported execution plan should be the
queued in-process path.
Examples
# \donttest{
db <- duckdb::dbConnect(duckdb::duckdb(config = list(allow_unsigned_extensions = "true")))
#> duckdb keeps downloaded extensions and secrets in a temporary directory:
#> ℹ /tmp/Rtmp7iTOSm/duckdb
#> This is removed when the R session ends.
#> • Extensions are re-downloaded each session.
#> • Secrets are lost.
#> ℹ Run duckdb(shared_home = TRUE) (or create ~/.duckdb) to keep them (suitable for most users).
#> ℹ Run duckdb(shared_home = FALSE) to accept the temporary directory (and silence this message).
#> ℹ See ?duckdb_storage for details and alternatives.
rducks_enable(db)
rducks_enable_inproc(db)
rducks_release(db)
DBI::dbDisconnect(db)
# }