pg_pgbouncer
pg_pgbouncer · Runs and manages external PgBouncer processes from a PostgreSQL background worker through a pgrx extension.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100723 | pg_pgbouncer | pg_pgbouncer | 0.0.0 | ADMIN | MIT | Rust |
PostgreSQL · 16
Usage
Sources:
- Upstream README at the reviewed commit
- Extension schema and bootstrap data
- Process manager implementation
pg_pgbouncer is an alpha-quality pgrx extension that runs a PostgreSQL background worker to generate configuration and supervise external pgbouncer processes. Upstream explicitly does not recommend it for production and warns that its API may change substantially.
Restart PostgreSQL, create pg_pgbouncer in that exact database, and ensure the operating-system account can find and execute the pgbouncer binary. Configuration is stored in pgbouncer.groups, pgbouncer.databases, pgbouncer.users, pgbouncer.peers, pgbouncer.auth, pgbouncer.hba, and pgbouncer.settings; the manager writes INI files and starts or signals child processes.
The bootstrap SQL copies password values from pg_shadow, stores credentials in ordinary tables, enables trust authentication, and includes example users. Treat it as unsafe sample state: isolate a disposable cluster, revoke schema/table access from PUBLIC, replace every default, protect generated files, and audit process ownership and signal handling.
The worker is cluster-level and connects through SPI as a superuser. A database outage, malformed table row, missing executable, stale PID/socket, or rapidly crashing child can disrupt supervision. For production use, manage PgBouncer with an operating-system service manager and its supported configuration workflow.