PostgreSQL has a rather heavyweight connection handling architecture. For each incoming connection, the postmaster (the main Postgres daemon) forks out a new process (conventionally called a backend) to handle it. While this design provides better stability and isolation, it does not make it particularly efficient at handling short-lived connections. A new Postgres client connection involves TCP setup, process creation and backend initialization – all of which are costly in terms of time and system resources. For More...
PgBouncer relies on a main configuration file, typically stored as
/etc/pgbouncer/pgbouncer.ini. You can invoke pgbouncer as a systemd service, or simply run it even without superuser privileges with the path to this configuration file.