DBAtlas · Database operations atlas

Show PgBouncer pools, statistics and connections (SHOW POOLS/STATS/CLIENTS/SERVERS)

PostgreSQLPgBouncer

Command

# Connect to the PgBouncer admin console (user must be in admin_users/stats_users):
psql -h 127.0.0.1 -p 6432 -U pgbouncer -d pgbouncer -X
SHOW POOLS;    -- if cl_waiting > 0 and maxwait grows, the pool is saturated
SHOW STATS;    -- per-database total/average query, transaction and wait times
SHOW CLIENTS;  -- client connections (state, source address, linked server connection)
SHOW SERVERS;  -- server connections opened to PostgreSQL
SHOW CONFIG;

What it does

For each database/user pool, shows active and waiting clients (cl_active, cl_waiting), active/idle server connections (sv_active, sv_idle), the longest wait time (maxwait) and query/transaction counters.

When to use it

When the application reports connection failures/timeouts, for pool sizing, and to see active connections before maintenance.

Caution

The admin console does not accept SQL; it runs PgBouncer commands only. If cl_waiting stays high, first check the server side for long transactions or locks; blindly raising default_pool_size pushes PostgreSQL toward its max_connections limit and memory pressure. SHOW STATS values are cumulative; averages refer to the stats_period interval.

Open in DBAtlas →

Related