PgBouncer is made available on Bridge instances by default to ease connection management by multiplexing native Postgres connections across its own "virtual" connections.
Although the PgBouncer service is available on Bridge instances by default,
you'll need to take one extra step on each database you want to use it on by
As the superuser, run this in the database to install the
CREATE EXTENSION crunchy_pooler;
crunchy_pooler is simple extension which creates a user called
crunchy_pooler with access to a single function called
allows PgBouncer to authenticate incoming connections. Now when a client makes a
connection to PgBouncer, it can check whether its credentials are valid by
querying Postgres' canonical user store.
crunchy_pooler extension must be installed in each database where you want to connect to PgBouncer. Otherwise you may receive an error like:
failed: FATAL: bouncer config error
Connect to the database and run:
create extension crunchy_pooler; to resolve the error.
Clients will connect to PgBouncer using the same connection string they'd use
for the main Postgres database, except on port
5431 instead of the usual
You can connect to PgBouncer using the
application role, any individual user role created for team members, or any custom user roles that you may have created (for example, using the
CREATE ROLE SQL command). The
user_lookup function created by
crunchy_pooler will deny lookups on superusers and replication roles -- only roles without superuser or replication privileges will be able to connect through PgBouncer. See User Management for more about Postgres users and roles on Crunchy Bridge.
The terms "user" and "role" in Postgres are largely synonymous, with a minor
difference being that
CREATE USER (versus
CREATE ROLE) implies
privilege, so according to the principle of least
CREATE ROLE is the better choice for users/roles that meant for use by
applications rather than people.
crunchy_pooler exception will functionally disable PgBouncer as
it'll no longer be able to authenticate:
DROP EXTENSION crunchy_pooler;