PGBOUNCER(1)

๐Ÿ‘‘ PGBOUNCER(1) โ€” the pgbouncer(1) glow-up ๐Ÿฆ‹

okay so bestie, sit down, hydrate, and get comfy, because we're about to read the manual page for pgbouncer โ€” that's the lightweight connection pooler for PostgreSQL โ€” and honestly? It's giving main character energy for your database layer. ๐Ÿ’…


โœจ NAME โœจ

pgbouncer โ€” a lightweight connection pooler for PostgreSQL. That's the whole vibe. ๐Ÿซถ


๐ŸŒˆ SYNOPSIS ๐ŸŒˆ

The classic:

pgbouncer [-d][-v][-u user] <pgbouncer.ini>
pgbouncer -V|-h

And on Windows, the options are:

pgbouncer.exe [-v][-u user] <pgbouncer.ini>
pgbouncer.exe -V|-h

Additional options for setting up a Windows service:

pgbouncer.exe --regservice   <pgbouncer.ini>
pgbouncer.exe --unregservice <pgbouncer.ini>

๐Ÿ’– DESCRIPTION ๐Ÿ’–

So like, pgbouncer is a PostgreSQL connection pooler. Any target application can connect to pgbouncer like it's just a regular PostgreSQL server โ€” no cap โ€” and then pgbouncer will either create a connection to the actual server, or it'll reuse one of the connections it already has sitting there. Iconic recycling behavior. โ™ป๏ธ

The whole point, the ~aim~ of pgbouncer, is to lower the performance impact of opening new connections to PostgreSQL. Opening fresh connections is expensive; pgbouncer said "not on my watch." ๐Ÿ’€

And here's the important part: so that it doesn't compromise transaction semantics for connection pooling, pgbouncer supports several types of pooling when rotating connections:

  • Session pooling โ€” the most polite method. When a client connects, a server connection gets assigned to it for the whole duration the client stays connected. When the client disconnects, the server connection gets put back into the pool. This is the default method. ๐ŸŽ€
  • Transaction pooling โ€” a server connection is assigned to a client only during a transaction. When PgBouncer notices that the transaction is over, the server connection gets put back into the pool. โœจ
  • Statement pooling โ€” the most aggressive method. The server connection gets put back into the pool immediately after a query completes. Multi-statement transactions are disallowed in this mode because they would break. ๐Ÿซ 

And the administration interface of pgbouncer? It consists of some new SHOW commands that are available when you're connected to a special "virtual" database called pgbouncer. Very exclusive, very VIP. ๐Ÿ‘‘


๐Ÿš€ QUICK-START ๐Ÿš€

Basic setup and usage is as follows, bestie. Follow along:

  1. Create a pgbouncer.ini file. Details in pgbouncer(5). Simple example:
[databases]
template1 = host=localhost port=5432 dbname=template1

[pgbouncer]
listen_port = 6432
listen_addr = localhost
auth_type = md5
auth_file = userlist.txt
logfile = pgbouncer.log
pidfile = pgbouncer.pid
admin_users = someuser
  1. Create a userlist.txt file that contains the users allowed in:
"someuser" "same_password_as_in_server"
  1. Launch pgbouncer:
$ pgbouncer -d pgbouncer.ini
  1. Have your application (or the psql client) connect to pgbouncer instead of directly to the PostgreSQL server:
$ psql -p 6432 -U someuser template1
  1. Manage pgbouncer by connecting to the special administration database pgbouncer and issuing SHOW HELP; to begin:
$ psql -p 6432 -U someuser pgbouncer
pgbouncer=# SHOW HELP;
NOTICE:  Console usage
DETAIL:
  SHOW [HELP|CONFIG|DATABASES|POOLS|CLIENTS|SERVERS|SOCKETS|LISTS|VERSION|...]
  SET key = arg
  RELOAD
  PAUSE
  RESUME
  SHUTDOWN
  [...]
  1. If you made changes to the pgbouncer.ini file, you can reload it with:
pgbouncer=# RELOAD;

Slay. You're basically a DBA now. ๐ŸŒˆ


๐ŸŽ€ COMMAND LINE SWITCHES ๐ŸŽ€

  • -d, --daemon โ€” run in the background. Without it, the process runs in the foreground. ๐ŸŒ€

Heads up: in daemon mode, setting pidfile as well as logfile or syslog is required. No log messages will be written to stderr after going into the background.

Note: does not work on Windows; pgbouncer needs to run as a service there.
  • -u USERNAME, --user=USERNAME โ€” switch to the given user on startup. ๐Ÿซถ
  • -v, --verbose โ€” increase verbosity. Can be used multiple times. (Yes bestie, stack them. Go off.) ๐Ÿ”ฅ
  • -q, --quiet โ€” be quiet: do not log to stderr. This does not affect logging verbosity โ€” only that stderr is not to be used. For use in init.d scripts. ๐Ÿคซ
  • -V, --version โ€” show version. โญ
  • -h, --help โ€” show short help. ๐Ÿ’œ
  • --regservice โ€” Win32: register PgBouncer to run as a Windows service. The service_name configuration parameter value is used as the name to register under. ๐ŸชŸ
  • --unregservice โ€” Win32: unregister the Windows service. ๐ŸชŸ

๐Ÿ’… ADMIN CONSOLE ๐Ÿ’…

The console is available by connecting as normal to the database pgbouncer:

$ psql -p 6432 pgbouncer

Only users listed in the configuration parameters admin_users or stats_users are allowed to log in to the console. (Except when auth_type=any, then any user is allowed in as a stats_user.) ๐ŸŽŸ๏ธ

Additionally, the user name pgbouncer is allowed to log in without a password, if the login comes via the Unix socket and the client has the same Unix user UID as the running process. โœจ

Real talk: the admin console currently only supports the simple query protocol. Some drivers use the extended query protocol for all commands; those drivers will not work for this. ๐Ÿ˜ญ Not their fault, but also not pgbouncer's problem.

๐ŸŒธ Show commands ๐ŸŒธ

The SHOW commands output information. Each command is described below. ๐Ÿฆ‹

๐ŸŒŸ SHOW STATS ๐ŸŒŸ

Shows statistics. In this and related commands, the total figures are since process start, and the averages are updated every stats_period. ๐Ÿ“Š

  • database โ€” statistics are presented per database.
  • total_xact_count โ€” total number of SQL transactions pooled by pgbouncer.
  • total_query_count โ€” total number of SQL commands pooled by pgbouncer.
  • total_server_assignment_count โ€” total times a server was assigned to a client.
  • total_received โ€” total volume in bytes of network traffic received by pgbouncer.
  • total_sent โ€” total volume in bytes of network traffic sent by pgbouncer.
  • total_xact_time โ€” total number of microseconds spent by pgbouncer when connected to PostgreSQL in a transaction, either idle in transaction or executing queries.
  • total_query_time โ€” total number of microseconds spent by pgbouncer when actively connected to PostgreSQL, executing queries.
  • total_wait_time โ€” time spent by clients waiting for a server, in microseconds. Updated when a client connection is assigned a backend connection.
  • total_client_parse_count โ€” total number of prepared statements created by clients. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • total_server_parse_count โ€” total number of prepared statements created by pgbouncer on a server. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • total_bind_count โ€” total number of prepared statements readied for execution by clients and forwarded to PostgreSQL by pgbouncer. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • total_client_login_count โ€” total number of successful client logins.
  • avg_xact_count โ€” average transactions per second in last stat period.
  • avg_query_count โ€” average queries per second in last stat period.
  • avg_server_assignment_count โ€” average number of times a server was assigned to a client per second in the last stat period.
  • avg_recv โ€” average received (from clients) bytes per second.
  • avg_sent โ€” average sent (to clients) bytes per second.
  • avg_xact_time โ€” average transaction duration, in microseconds.
  • avg_query_time โ€” average query duration, in microseconds.
  • avg_wait_time โ€” time spent by clients waiting for a server, in microseconds (average of the wait times for clients assigned a backend during the current stats_period).
  • avg_client_parse_count โ€” average number of prepared statements created by clients. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • avg_server_parse_count โ€” average number of prepared statements created by pgbouncer on a server. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • avg_bind_count โ€” average number of prepared statements readied for execution by clients and forwarded to PostgreSQL by pgbouncer. Only applicable in named prepared statement tracking mode, see max_prepared_statements.
  • avg_client_login_count โ€” average number of successful client logins per second.

โญ SHOW STATS_TOTALS โญ

A subset of SHOW STATS showing the total values (total_). ๐Ÿงฎ

โญ SHOW STATS_AVERAGES โญ

A subset of SHOW STATS showing the average values (avg_). ๐Ÿ“ˆ

๐ŸŒˆ SHOW TOTALS ๐ŸŒˆ

Like SHOW STATS but aggregated across all databases. The big picture, bestie. ๐Ÿซถ

๐Ÿฆ‹ SHOW SERVERS ๐Ÿฆ‹

  • type โ€” S, for server.
  • user โ€” user name pgbouncer uses to connect to server.
  • database โ€” database name.
  • replication โ€” if the server connection uses replication. Can be none, logical or physical.
  • state โ€” state of the PgBouncer server connection, one of active, idle, used, tested, new, active_cancel, being_canceled.
  • addr โ€” IP address of the PostgreSQL server.
  • port โ€” port of the PostgreSQL server.
  • local_addr โ€” connection start address on local machine.
  • local_port โ€” connection start port on local machine.
  • connect_time โ€” when the connection was made.
  • request_time โ€” when the last request was issued.
  • wait โ€” not used for server connections.
  • wait_us โ€” not used for server connections.
  • close_needed โ€” 1 if the connection will be closed as soon as possible, because a configuration file reload or DNS update changed the connection information or RECONNECT was issued.
  • ptr โ€” address of internal object for this connection.
  • link โ€” address of client connection the server is paired with.
  • remote_pid โ€” PID of backend server process. In case the connection is made over Unix socket and the OS supports getting process ID info, its OS PID. Otherwise it's extracted from the cancel packet the server sent, which should be the PID in case the server is PostgreSQL, but it's a random number in case the server is another PgBouncer. ๐Ÿ™ˆ
  • tls โ€” a string with TLS connection information, or empty if not using TLS.
  • application_name โ€” a string containing the application_name set on the linked client connection, or empty if this is not set, or if there is no linked connection.

okay that's part one, and there's more coming so don't go anywhere bestie ๐ŸŽ€

  • prepared_statements โ€” how many prepared statements are currently prepped on the server. The ceiling for this is the max_prepared_statements setting, so that's the vibe limit ๐Ÿ’…
  • id โ€” the server's unique ID, like its own little name tag ๐Ÿท๏ธ

๐Ÿฆ‹ SHOW CLIENTS ๐Ÿฆ‹

  • type โ€” it's C, for client. Obviously ๐Ÿ’โ€โ™€๏ธ
  • user โ€” the client's connected user.
  • database โ€” database name, bestie.
  • replication โ€” whether the client connection uses replication. Can be none, logical, or physical.
  • state โ€” the client connection's state, and it's one of: active (client connections linked to server connections), idle (client connections with no queries waiting to be processed), waiting, active_cancel_req, or waiting_cancel_req.
  • addr โ€” the client's IP address.
  • port โ€” the client's source port.
  • local_addr โ€” the connection end address on the local machine.
  • local_port โ€” the connection end port on the local machine.
  • connect_time โ€” timestamp of when the connection happened.
  • request_time โ€” timestamp of the latest client request.
  • wait โ€” the current waiting time, in seconds.
  • wait_us โ€” the microsecond part of that current waiting time.
  • close_needed โ€” literally not used for clients ๐Ÿ™ˆ
  • ptr โ€” the address of the internal object for this connection.
  • link โ€” the address of the server connection this client is paired with.
  • remote_pid โ€” process ID, in case the client connects over a Unix socket and the OS supports getting it.
  • tls โ€” a string with TLS connection info, or empty if TLS isn't being used.
  • application_name โ€” a string containing the application_name set by the client for this connection, or empty if it wasn't set.
  • prepared_statements โ€” the amount of prepared statements the client has prepared.
  • id โ€” unique ID for the client. Every main character needs one ๐Ÿ‘‘

๐ŸŒธ SHOW POOLS ๐ŸŒธ

A new pool entry gets made for each (database, user) couple. It's giving paired-up dynamic duo energy ๐Ÿ’–

  • database โ€” database name.
  • user โ€” user name.
  • cl_active โ€” client connections that are either linked to server connections, or idle with no queries waiting to be processed.
  • cl_waiting โ€” client connections that have sent queries but haven't gotten a server connection yet. They're in line, bestie ๐Ÿ˜ญ
  • cl_active_cancel_req โ€” client connections that have forwarded query cancellations to the server and are waiting for the server response.
  • cl_waiting_cancel_req โ€” client connections that haven't forwarded query cancellations to the server yet.
  • sv_active โ€” server connections that are linked to a client.
  • sv_active_cancel โ€” server connections that are currently forwarding a cancel request.
  • sv_being_canceled โ€” servers that normally could become idle, but are waiting to do so until all in-flight cancel requests have completed. Those are the requests sent to cancel a query on this server, btw.
  • sv_idle โ€” server connections that are unused and immediately usable for client queries. Iconic availability โœจ
  • sv_used โ€” server connections that have been idle for more than server_check_delay, so server_check_query needs to run on them before they can be used again.
  • sv_tested โ€” server connections currently running either server_reset_query or server_check_query.
  • sv_login โ€” server connections currently in the process of logging in.
  • maxwait โ€” how long the first (aka oldest) client in the queue has waited, in seconds.
If this starts increasing, then the current pool of servers isn't handling requests quickly enough. The reason may be either an overloaded server or just too small of a pool_size setting. That's your cue to look at it, bestie ๐Ÿ’€
  • maxwait_us โ€” the microsecond part of the maximum waiting time.
  • pool_mode โ€” the pooling mode in use.
  • load_balance_hosts โ€” the load_balance_hosts in use, if the pool's host contains a comma-separated list.

๐ŸŽ€ SHOW PEER_POOLS ๐ŸŽ€

A new peer_pool entry gets made for each configured peer. Peer pool era ๐Ÿซถ

  • peer_id โ€” ID of the configured peer entry.
  • cl_active_cancel_req โ€” client connections that have forwarded query cancellations to the server and are waiting for the server response.
  • cl_waiting_cancel_req โ€” client connections that haven't forwarded query cancellations to the server yet.
  • sv_active_cancel โ€” server connections that are currently forwarding a cancel request.
  • sv_login โ€” server connections currently in the process of logging in.

๐ŸŒˆ SHOW LISTS ๐ŸŒˆ

Shows the following internal info, in columns (not rows โ€” yes, it's that kind of layout, don't come for me):

  • databases โ€” count of databases.
  • users โ€” count of users.
  • pools โ€” count of pools.
  • free_clients โ€” count of free clients. These are clients that are disconnected, but PgBouncer keeps the memory around that was allocated for them so it can be reused for future clients and avoid allocations.
  • used_clients โ€” count of used clients.
  • login_clients โ€” count of clients in login state.
  • free_servers โ€” count of free servers. These are servers that are disconnected, but PgBouncer keeps the memory around that was allocated for them so it can be reused for future servers and avoid allocations.
  • used_servers โ€” count of used servers.
  • dns_names โ€” count of DNS names in the cache.
  • dns_zones โ€” count of DNS zones in the cache.
  • dns_queries โ€” count of in-flight DNS queries.
  • dns_pending โ€” not used ๐Ÿ™ƒ

๐Ÿ’œ SHOW USERS ๐Ÿ’œ

  • name โ€” the user name.
  • pool_size โ€” the user's override pool_size, or NULL if not set.
  • reserve_pool_size โ€” the user's override reserve_pool_size, or NULL if not set.
  • pool_mode โ€” the user's override pool_mode, or NULL if not set.
  • max_user_connections โ€” the user's max_user_connections setting. If this setting isn't set for this specific user, then the default value will be displayed.
  • current_connections โ€” current number of server connections that this user has open to all servers.
  • max_user_client_connections โ€” the user's max_user_client_connections setting. If this setting isn't set for this specific user, then the default value will be displayed.
  • current_client_connections โ€” current number of client connections that this user has open to PgBouncer.

๐Ÿฆ‹ SHOW DATABASES ๐Ÿฆ‹

  • name โ€” name of the configured database entry.
  • host โ€” host PgBouncer connects to.
  • port โ€” port PgBouncer connects to.
  • database โ€” actual database name PgBouncer connects to.
  • force_user โ€” when the user is part of the connection string, the connection between PgBouncer and PostgreSQL is forced to the given user, whatever the client user. No negotiating ๐Ÿ’…
  • pool_size โ€” maximum number of server connections.
  • min_pool_size โ€” minimum number of server connections.
  • reserve_pool_size โ€” maximum number of additional connections for this database.
  • server_lifetime โ€” the maximum lifetime of a server connection for this database.
  • pool_mode โ€” the database's override pool_mode, or NULL if the default will be used instead.
  • load_balance_hosts โ€” the database's load_balance_hosts, if the host contains a comma-separated list.
  • max_connections โ€” maximum number of allowed server connections for this database, as set by max_db_connections, either globally or per database.
  • current_connections โ€” current number of server connections for this database.
  • max_client_connections โ€” maximum number of allowed client connections for this PgBouncer instance, as set by max_db_client_connections per database.
  • current_client_connections โ€” current number of client connections for this database.
  • paused โ€” 1 if this database is currently paused, else 0.
  • disabled โ€” 1 if this database is currently disabled, else 0.

๐ŸŒธ SHOW PEERS ๐ŸŒธ

  • peer_id โ€” ID of the configured peer entry.
  • host โ€” host PgBouncer connects to.
  • port โ€” port PgBouncer connects to.
  • pool_size โ€” maximum number of server connections that can be made to this peer.

๐Ÿซถ SHOW SOCKETS, SHOW ACTIVE_SOCKETS ๐Ÿซถ

Shows low-level info about sockets โ€” or only active sockets, when you use the active version. This includes the info shown under SHOW CLIENTS and SHOW SERVERS, plus other more low-level information. It's the behind-the-scenes lore โœจ

๐Ÿ’… SHOW CONFIG ๐Ÿ’…

Shows the current configuration settings, one per row, with these columns:

  • key โ€” configuration variable name.
  • value โ€” configuration value.
  • default โ€” configuration default value.
  • changeable โ€” either yes or no, showing if the variable can be changed while running. If no, the variable can be changed only at boot time. Use SET to change a variable at run time.

๐Ÿงš SHOW MEM ๐Ÿงš

Shows low-level info about the current sizes of various internal memory allocations. The information presented is subject to change โ€” so don't get too attached, bestie.

๐Ÿ“ SHOW DNS_HOSTS ๐Ÿ“

Shows host names in the DNS cache.

  • hostname โ€” host name.
  • ttl โ€” how many seconds until the next lookup.
  • addrs โ€” comma-separated list of addresses.

๐Ÿ‘‘ SHOW DNS_ZONES ๐Ÿ‘‘

Shows DNS zones in the cache.

  • zonename โ€” zone name.
  • serial โ€” current serial.
  • count โ€” host names belonging to this zone.

โญ SHOW VERSION โญ

Shows the PgBouncer version string. Slay, version reveal ๐Ÿ’–

๐ŸŽฎ SHOW STATE ๐ŸŽฎ

Shows the PgBouncer state settings. Current states are active and paused.

๐Ÿ”ฅ PROCESS CONTROLLING COMMANDS ๐Ÿ”ฅ

๐Ÿ’… PAUSE [db] ๐Ÿ’…

PgBouncer tries to disconnect from all servers. Disconnecting each server connection waits for that server connection to be released according to the server pool's pooling mode โ€” in transaction pooling mode, the transaction must complete; in statement mode, the statement must complete; and in session pooling mode, the client must disconnect. The command will not return before all server connections have been disconnected. To be used at the time of database restart.

If a database name is given, only that database will be paused.

New client connections to a paused database will wait until RESUME is called. So yes, they're waiting outside like ๐Ÿงโ€โ™€๏ธ๐Ÿงโ€โ™€๏ธ๐Ÿงโ€โ™€๏ธ

๐ŸŽ€ DISABLE db ๐ŸŽ€

Reject all new client connections on the given database. Not today, new clients ๐Ÿ’€

โœจ ENABLE db โœจ

Allow new client connections after a previous DISABLE command. Welcome back, besties ๐Ÿซถ

๐ŸŒˆ RECONNECT [db] ๐ŸŒˆ

Close each open server connection for the given database โ€” or all databases โ€” after it's released (according to the pooling mode), even if its lifetime isn't up yet. New server connections can be made immediately and will connect as necessary according to the pool size settings. Fresh connections, no cap ๐Ÿ”ฅ

okay so this command is useful when the server connection setup has changed โ€” like, say, you want to do a gradual switchover to a new server. ๐Ÿฆ‹ It is not necessary to run this command when the connection string in pgbouncer.ini has been changed and reloaded (see RELOAD) or when DNS resolution has changed, because then the equivalent of this command will be run automatically. This command is only necessary if something downstream of PgBouncer routes the connections. iykyk ๐Ÿ’…

After this command is run, there could be an extended period where some server connections go to an old destination and some server connections go to a new destination. This is likely only sensible when switching read-only traffic between read-only replicas, or when switching between nodes of a multimaster replication setup. If all connections need to be switched at the same time, PAUSE is recommended instead. To close server connections without waiting (for example, in emergency failover rather than gradual switchover scenarios), also consider KILL. ๐Ÿ”ฅ

๐Ÿ’… KILL [db]

Immediately drop all client and server connections on the given database or all databases, excluding the admin database. no cap ๐Ÿซถ

New client connections to a killed database will wait until RESUME is called.

๐Ÿ’… KILL_CLIENT id

Immediately kill the specified client connection along with any server connections for the given client. The client to kill is identified by the id value that can be found using the SHOW CLIENTS command. ๐Ÿ‘‘

An example command will look something like KILL_CLIENT 1234.

๐Ÿ’… RESUME [db]

Resume work from a previous KILL or PAUSE command. we love a comeback era โœจ

๐Ÿ’… SHUTDOWN

The PgBouncer process will exit. bye bestie ๐Ÿ’€

๐Ÿ›‘ SHUTDOWN WAIT_FOR_SERVERS

Stop accepting new connections and shutdown after all servers are released. This is basically the same as issuing PAUSE and SHUTDOWN, except that this also stops accepting new connections while waiting for the PAUSE as well as eagerly disconnecting clients that are waiting to receive a server connection. Please note that UNIX sockets will remain open during the shutdown but will only accept connections to the PgBouncer admin console. ๐Ÿงš

๐Ÿ›‘ SHUTDOWN WAIT_FOR_CLIENTS

Stop accepting new connections and shutdown the process once all existing clients have disconnected. Please note that UNIX sockets will remain open during the shutdown but will only accept connections to the pgbouncer admin console. This command can be used to do zero-downtime rolling restart of two PgBouncer processes using the following procedure: ๐ŸŒˆ

  1. Have two or more PgBouncer processes running on the same port using so_reuseport (configuring peering is recommended, but not required). To achieve zero downtime when restarting weโ€™ll restart these processes one-by-one, thus leaving the others running to accept connections while one is being restarted.
  2. Pick a process to restart first, letโ€™s call it A.
  3. Run SHUTDOWN WAIT_FOR_CLIENTS (or send SIGTERM) to process A.
  4. Cause all clients to reconnect. Possibly by waiting some time until the client side pooler causes reconnects due to its server_idle_timeout (or similar config). Or if no client side pooler is used, possibly by restarting the clients. Once all clients have reconnected, process A will exit automatically, because no clients are connected to it anymore.
  5. Start process A again.
  6. Repeat step 3, 4 and 5 for each of the remaining processes, one-by-one until you restarted all processes.

๐Ÿ’… RELOAD

The PgBouncer process will reload its configuration files and update changeable settings. This includes the main configuration file as well as the files specified by the settings auth_file and auth_hba_file. ๐ŸŽ€

PgBouncer notices when a configuration file reload changes the connection parameters of a database definition. An existing server connection to the old destination will be closed when the server connection is next released (according to the pooling mode), and new server connections will immediately use the updated connection parameters. obsessssed with a clean reload โœจ

๐Ÿ’… WAIT_CLOSE [db]

Wait until all server connections, either of the specified database or of all databases, have cleared the close_needed state (see SHOW SERVERS). This can be called after a RECONNECT or RELOAD to wait until the respective configuration change has been fully activated, for example in switchover scripts. ๐Ÿฆ‹

โœจ Other commands โœจ

๐Ÿ’… SET key = arg

Changes a configuration setting (see also SHOW CONFIG). For example:

SET log_connections = 1;
SET server_check_query = 'select 2';

(Note that this command is run on the PgBouncer admin console and sets PgBouncer settings. A SET command run on another database will be passed to the PostgreSQL backend like any other SQL command.) ๐Ÿ’œ

๐Ÿ“ก Signals ๐Ÿ“ก

  • SIGHUP โ€” Reload config. Same as issuing the command RELOAD on the console.
  • SIGTERM โ€” Super safe shutdown. Wait for all existing clients to disconnect, but donโ€™t accept new connections. This is the same as issuing SHUTDOWN WAIT_FOR_CLIENTS on the console. If this signal is received while there is already a shutdown in progress, then an โ€œimmediate shutdownโ€ is triggered instead of a โ€œsuper safe shutdownโ€. In PgBouncer versions earlier than 1.23.0, this signal would cause an โ€œimmediate shutdownโ€. ๐Ÿ˜ญ
  • SIGINT โ€” Safe shutdown. Same as issuing SHUTDOWN WAIT_FOR_SERVERS on the console. If this signal is received while there is already a shutdown in progress, then an โ€œimmediate shutdownโ€ is triggered instead of a โ€œsafe shutdownโ€.
  • SIGQUIT โ€” Immediate shutdown. Same as issuing SHUTDOWN on the console.
  • SIGUSR1 โ€” Same as issuing PAUSE on the console.
  • SIGUSR2 โ€” Same as issuing RESUME on the console.

๐ŸŒˆ Libevent settings ๐ŸŒˆ

From the Libevent documentation:

It is possible to disable support for epoll, kqueue, devpoll, poll or select by setting the environment variable EVENT_NOEPOLL, EVENT_NOKQUEUE, EVENT_NODEVPOLL, EVENT_NOPOLL or EVENT_NOSELECT, respectively. By setting the environment variable EVENT_SHOW_METHOD, libevent displays the kernel notification method that it uses.

๐Ÿซถ SEE ALSO ๐Ÿซถ


signing off from the PGBOUNCER(1) page, version 1.26.1 โ€” mwah, bestie ๐Ÿ’‹๐Ÿ’–

๐Ÿ“ฆ where this page comes from