How it works...

By connecting to the pgbouncer database name on port 6432, we connect to PgBouncer using a simulated database that doesn't actually exist. This name tells PgBouncer that we want the administration console. If we configured PgBouncer according to the Configure PgBouncer safely recipe, the postgres user is the only database user allowed to use the console.

The author wishes that this information were also available as a view so that we could fetch only interesting fields, but the PgBouncer syntax is easier to type. By sending SHOW SERVERS as a query, PgBouncer responds with a list of every connection to PostgreSQL it is using to fulfill client requests. Fields of particular interest include the following:

  • user: This column ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.