GitHub

API reference for pool.

Pools of PostgreSQL sessions (Effect's @effect/sql-pg PgPool).

Sessions open as they are needed, up to max_connections, and close again down to min_connections after idle_timeout unused. A checkout skips (and replaces) a session that died, outlived its connection_ttl, or had a cancel PostgreSQL did not confirm. Every checkout is exclusive.

With SpanPropagationEnabled (and span timing), a statement that waited for a new session gets a db.connect child span covering the part of the connect it waited for, with db.client.connection.connect_time_ms.

Re-exports

Classes

Functions

make

make(config) -> Effect[PgPoolService, SqlError, Scope]

A pool; closing the scope closes every session.

ParameterTypeDescription
configPgPoolConfig

Returns Effect[PgPoolService, SqlError, Scope]

def make(config: PgPoolConfig) -> Effect[PgPoolService, SqlError, Scope]:
    """A pool; closing the scope closes every session."""
    return _WithFiber(lambda fiber: _make(config, _Connects(fiber.get_ref(Clock))))