sql-switch - v1.0.1
    Preparing search index...

    Interface PostgresConfig

    Config for production PostgreSQL mode — one logical schema per module.

    interface PostgresConfig {
        mode: "cloud";
        connectionString: string;
        pool?: {
            max?: number;
            connectionTimeoutMillis?: number;
            idleTimeoutMillis?: number;
            statementTimeout?: number;
        };
    }
    Index
    mode: "cloud"
    connectionString: string

    Full Postgres connection string. e.g. postgres://user:pass@localhost:5432/mydb

    pool?: {
        max?: number;
        connectionTimeoutMillis?: number;
        idleTimeoutMillis?: number;
        statementTimeout?: number;
    }

    Type Declaration

    • Optionalmax?: number

      Max connections in the local pool before PgBouncer multiplexing. Keep low (3–5) when running behind PgBouncer in transaction mode.

      5
      
    • OptionalconnectionTimeoutMillis?: number

      How long to wait for a free/new connection before giving up, in milliseconds.

      10000

      Bounds the wait when every slot is busy or the server is unreachable => without it a connection attempt can hang indefinitely. 0 waits forever (not recommended).

    • OptionalidleTimeoutMillis?: number

      How long an idle connection lingers in the pool before it's closed, in milliseconds.

      30000

      Reaping idle connections keeps the pool from holding server resources through quiet periods. 0 keeps them open indefinitely.

    • OptionalstatementTimeout?: number

      Ceiling on a single operation, in milliseconds. 0 turns it off.

      Without one, a query that never answers holds a pool connection for the rest of the process' life => max of those and every later read & write blocks with no error at all, which is a worse outage than the one that caused it. A flat key lookup is a couple of ms on a healthy database, so this isn't a performance budget, it's the line past which the answer is worth less than the connection.

      30000

      Enforced client side on every op, plus SET LOCAL statement_timeout inside the bulk flush transaction (the one op that can genuinely block on a lock). Never sent as a startup parameter => PgBouncer drops connections carrying parameters it doesn't track.