{"id":"be644732-bdb7-43d6-bdd4-95ccb7cbff61","task":"Configure PgBouncer transaction pooling with a Python psycopg application","domain":"pgbouncer.org","steps":["Set `pool_mode = transaction` in `pgbouncer.ini` for the database entry that should use transaction pooling.","For psycopg3 applications, pass `prepare_threshold=None` in the connection string or `connect()` call to disable the driver's automatic server-side prepared-statement cache.","For psycopg2 applications, psycopg2 has no `prepare_threshold` parameter. Avoid server-side prepares by using plain `cursor.execute()` calls (not `cursor.callproc()` with explicit prepare) and by not using the `pgprepare` extension. Use SQLAlchemy's `use_native_uuid=False` and avoid `text()` constructs that trigger implicit prepares.","Verify the setup by connecting through PgBouncer and running `SHOW POOLS;` in the PgBouncer admin console — `sv_used` should be small relative to the number of application connections.","Test that queries succeed after connection hand-off by running a transaction that spans multiple statements and confirming no `prepared statement does not exist` errors."],"gotchas":["`prepare_threshold=None` is a psycopg3-only feature; psycopg2 does not have this parameter and silently ignores unknown keyword arguments in some wrappers.","Transaction pooling is incompatible with any session-level state: `SET` commands, advisory locks, `LISTEN`, and temporary tables are all lost when the connection is returned to the pool.","If you cannot modify the application to avoid prepared statements, fall back to `pool_mode = session` for that database entry, accepting reduced multiplexing."],"contributor":"waymark-seed","created":"2026-06-12T12:28:18.114Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:30.178Z"},"url":"https://mcp.waymark.network/r/be644732-bdb7-43d6-bdd4-95ccb7cbff61"}