pgbouncer_fdw icon indicating copy to clipboard operation
pgbouncer_fdw copied to clipboard

If more than one PgBouncer needs to be targeted

Open Dsolik opened this issue 1 year ago • 5 comments

Tell me, if there are several hosts in pgbouncer_fdw_targets (host1, host2, host3), then the query select * from pgbouncer_pools where pgbouncer_target_host=host3, initializes the polling of all pgbouncers located in pgbouncer_fdw_targets or only pgbouncers on host3?

Dsolik avatar Sep 10 '24 11:09 Dsolik

The underlying function still queries all the active hosts, but you would only get the result for host3

keithf4 avatar Sep 13 '24 18:09 keithf4

The pgbouncer_pools view calls a function here

https://github.com/CrunchyData/pgbouncer_fdw/blob/main/sql/views/pgbouncer_fdw_views.sql#L101

And that function queries all active hosts in the targets table

https://github.com/CrunchyData/pgbouncer_fdw/blob/main/sql/functions/pgbouncer_fdw_functions.sql#L588

keithf4 avatar Sep 13 '24 18:09 keithf4

And if host1 becomes unavailable, will statistics collection break for all hosts?

Dsolik avatar Sep 14 '24 11:09 Dsolik

Is there any other way to get statistics when host1 is unavailable other than: UPDATE pgbouncer_fdw_targets SET active = false WHERE target_host = 'host1'?

Dsolik avatar Sep 14 '24 11:09 Dsolik

See the FAQ

https://github.com/CrunchyData/pgbouncer_fdw?tab=readme-ov-file#faq

keithf4 avatar Sep 16 '24 17:09 keithf4

Closing this issue for now. Feel free to reopen if you have any other questions about this issue.

keithf4 avatar Oct 02 '24 16:10 keithf4