pgbouncer - lightweight connection pooler for PostgreSQL (PgBouncer 1.25)
pgbouncer [-d] [-R] [-v] [-u user] <pgbouncer.ini>
Options you will use
-d, --daemon- run in the background.
-R, --reboot- online restart (deprecated: use so_reuseport).
-u, --user=USERNAME- assume identity of USERNAME.
-v, --verbose- increase verbosity.
-q, --quiet- run quietly.
-V, --version- show version, then exit.
Examples
$ sudo -u postgres psql -h /var/run/postgresql -p 6432 -U pgbouncer pgbouncer -c "show pools"clients waiting? server connections in use?
$ sudo systemctl reload pgbouncerre-read pgbouncer.ini without dropping clients
Gotchas
- Transaction pooling breaks session state: SET outside a transaction, SQL PREPARE, LISTEN, session advisory locks. Protocol-level prepared statements are tracked (max_prepared_statements).
- In SHOW POOLS, cl_waiting > 0 with a climbing maxwait means the pool is too small or transactions are too long.
- The console for user pgbouncer over the Unix socket needs no password from the OS user PgBouncer runs as: sudo -u postgres psql -h /var/run/postgresql -p 6432 -U pgbouncer pgbouncer.
Try pgbouncer in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.