pgbouncer_fdw
pgbouncer_fdw
pgbouncer_fdw : Extension for querying PgBouncer stats from normal SQL views & running pgbouncer commands from normal SQL functions
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 8650 | pgbouncer_fdw
|
pgbouncer_fdw
|
1.4.0 |
FDW
|
PostgreSQL
|
SQL
|
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d--
|
No
|
Yes
|
No
|
Yes
|
no
|
no
|
| Relationships | |
|---|---|
| Requires | dblink
|
| See Also | dblink
postgres_fdw
pg_stat_monitor
pg_stat_statements
wrappers
multicorn
odbc_fdw
jdbc_fdw
|
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PGDG
|
1.4.0 |
18
17
16
15
14
|
pgbouncer_fdw |
dblink |
| RPM | PGDG
|
1.4.0 |
18
17
16
15
14
|
pgbouncer_fdw_$v |
- |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
el8.aarch64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
el9.x86_64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
el9.aarch64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
el10.x86_64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
el10.aarch64
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
PGDG 1.4.0
|
d12.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d12.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d13.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
d13.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u22.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u22.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u24.x86_64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
u24.aarch64
|
MISS
|
MISS
|
MISS
|
MISS
|
MISS
|
| Package | Version | OS | ORG | SIZE | File URL |
|---|---|---|---|---|---|
pgbouncer_fdw_18 |
1.4.0 |
el8.x86_64 | pgdg | 24.0 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel8.x86_64.rpm |
pgbouncer_fdw_18 |
1.4.0 |
el8.aarch64 | pgdg | 23.9 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel8.aarch64.rpm |
pgbouncer_fdw_18 |
1.4.0 |
el9.x86_64 | pgdg | 21.9 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel9.x86_64.rpm |
pgbouncer_fdw_18 |
1.4.0 |
el9.aarch64 | pgdg | 21.8 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel9.aarch64.rpm |
pgbouncer_fdw_18 |
1.4.0 |
el10.x86_64 | pgdg | 22.4 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel10.x86_64.rpm |
pgbouncer_fdw_18 |
1.4.0 |
el10.aarch64 | pgdg | 22.4 KiB | pgbouncer_fdw_18-1.4.0-1PGDG.rhel10.aarch64.rpm |
Source
Install
Make sure PGDG repo available:
pig repo add pgdg -u # add pgdg repo and update cacheInstall this extension with pig:
pig install pgbouncer_fdw; # install via package name, for the active PG version
pig install pgbouncer_fdw -v 18; # install for PG 18
pig install pgbouncer_fdw -v 17; # install for PG 17
pig install pgbouncer_fdw -v 16; # install for PG 16
pig install pgbouncer_fdw -v 15; # install for PG 15
pig install pgbouncer_fdw -v 14; # install for PG 14Create this extension with:
CREATE EXTENSION pgbouncer_fdw CASCADE; -- requires dblinkUsage
Create Server
CREATE EXTENSION pgbouncer_fdw;
CREATE SERVER pgbouncer FOREIGN DATA WRAPPER dblink_fdw
OPTIONS (host 'localhost', port '6432', dbname 'pgbouncer');For multiple PgBouncer instances:
CREATE SERVER pgbouncer1 FOREIGN DATA WRAPPER dblink_fdw
OPTIONS (host '192.168.1.10', port '6432', dbname 'pgbouncer');
CREATE SERVER pgbouncer2 FOREIGN DATA WRAPPER dblink_fdw
OPTIONS (host '192.168.1.11', port '6432', dbname 'pgbouncer');
INSERT INTO pgbouncer_fdw_targets (target_host) VALUES ('pgbouncer1'), ('pgbouncer2');
UPDATE pgbouncer_fdw_targets SET active = false WHERE target_host = 'pgbouncer';Create User Mapping
CREATE USER MAPPING FOR PUBLIC SERVER pgbouncer
OPTIONS (user 'ccp_monitoring', password 'mypassword');Available Views
| View | Description |
|---|---|
pgbouncer_clients |
Client connection details |
pgbouncer_pools |
Connection pool statistics |
pgbouncer_servers |
Backend server status |
pgbouncer_stats |
Statistics summary |
pgbouncer_databases |
Database definitions |
pgbouncer_config |
Configuration parameters |
pgbouncer_lists |
Internal lists |
pgbouncer_dns_hosts |
DNS host cache |
pgbouncer_dns_zones |
DNS zone cache |
pgbouncer_sockets |
Socket information |
pgbouncer_users |
User configuration |
SELECT * FROM pgbouncer_pools;
SELECT * FROM pgbouncer_stats;
SELECT database, cl_active, cl_waiting, sv_active FROM pgbouncer_pools;When monitoring multiple instances, each row includes a pgbouncer_target_host column identifying the source.
Command Functions
Administrative functions (require explicit GRANT EXECUTE):
SELECT pgbouncer_command_reload(); -- Reload configuration
SELECT pgbouncer_command_pause('mydb'); -- Pause a database
SELECT pgbouncer_command_resume('mydb'); -- Resume a database
SELECT pgbouncer_command_kill('mydb'); -- Kill connections
SELECT pgbouncer_command_disable('mydb'); -- Disable a database
SELECT pgbouncer_command_enable('mydb'); -- Enable a database
SELECT pgbouncer_command_reconnect('mydb'); -- Reconnect to backend
SELECT pgbouncer_command_set('key', 'value'); -- Set a parameter
SELECT pgbouncer_command_shutdown(); -- Shutdown PgBouncer
SELECT pgbouncer_command_suspend(); -- Suspend operations
SELECT pgbouncer_command_wait_close('mydb'); -- Wait for connections to closePermissions
GRANT USAGE ON FOREIGN SERVER pgbouncer TO monitoring_user;
GRANT SELECT ON pgbouncer_pools TO monitoring_user;
GRANT SELECT ON pgbouncer_stats TO monitoring_user;
GRANT EXECUTE ON FUNCTION pgbouncer_command_reload() TO admin_user;Last updated on