Skip to content

Pool: support configuring acquire mode#444

Merged
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:pool_acquire_mode
Apr 18, 2026
Merged

Pool: support configuring acquire mode#444
staticlibs merged 1 commit intoduckdb:mainfrom
staticlibs:pool_acquire_mode

Conversation

@staticlibs
Copy link
Copy Markdown
Collaborator

This PR adds new configuration option:

  • pg_pool_acquire_mode (VARCHAR, default: 'force'): how to acquire connections from the pool: 'force' (always connect, ignore pool limit), 'wait' (block until available), 'try' (fail immediately if unavailable)

This option is only applied to Postgres databases attached after the option is set.

To configure it for a Postgres database that is already attached, the acquire_mode named parameter is also added to
postgres_configure_pool() function:

FROM postgres_configure_pool(catalog_name='my_db', acquire_mode='wait')

Note, before this option the default pool behaviour was wait, now the default behaviour is changed to force.

This PR adds new configuration option:

 - `pg_pool_acquire_mode` (`VARCHAR`, default: 'force'): how to acquire
   connections from the pool: 'force' (always connect, ignore pool
   limit), 'wait' (block until available), 'try' (fail immediately if
   unavailable)

This option is only applied to Postgres databases attached after the
option is set.

To configure it for Postgres database that is already attached, the
`acquire_mode` named parameter is also added to
`postgres_configure_pool()` function:

```sql
FROM postgres_configure_pool(catalog_name='s', acquire_mode='wait')
```

Note, before this option the default pool behaviour was `wait`, now the
default behaviour is changed to `force`.
@staticlibs staticlibs merged commit 00792fc into duckdb:main Apr 18, 2026
4 checks passed
@staticlibs staticlibs deleted the pool_acquire_mode branch April 18, 2026 18:24
staticlibs added a commit to staticlibs/duckdb-postgres that referenced this pull request Apr 20, 2026
This PR changes the default scope from `SESSION` to `GLOBAL` for the
following options (see duckdb#430 and duckdb#444 for details):

 - `pg_pool_acquire_mode`
 - `pg_pool_max_connections`
 - `pg_pool_wait_timeout_millis`
 - `pg_pool_enable_thread_local_cache`
 - `pg_pool_max_lifetime_millis`
 - `pg_pool_idle_timeout_millis`
 - `pg_pool_enable_reaper_thread`
 - `pg_pool_health_check_query`

Additionally it changes the default size of the connection pool to
`max(cpu_count * 1.5, 8)`.

Fixes: duckdb/ducklake#1031
staticlibs added a commit that referenced this pull request Apr 20, 2026
This PR changes the default scope from `SESSION` to `GLOBAL` for the
following options (see #430 and #444 for details):

 - `pg_pool_acquire_mode`
 - `pg_pool_max_connections`
 - `pg_pool_wait_timeout_millis`
 - `pg_pool_enable_thread_local_cache`
 - `pg_pool_max_lifetime_millis`
 - `pg_pool_idle_timeout_millis`
 - `pg_pool_enable_reaper_thread`
 - `pg_pool_health_check_query`

Additionally it changes the default size of the connection pool to
`max(cpu_count * 1.5, 8)`.

Fixes: duckdb/ducklake#1031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant