CrunchyData / pgbouncer_fdw

PostgreSQL Foreign Data Wrapper to Connect to pgbouncer
Other
34 stars 10 forks source link

If more than one PgBouncer needs to be targeted #23

Closed Dsolik closed 2 months ago

Dsolik commented 2 months ago

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?

keithf4 commented 2 months ago

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

keithf4 commented 2 months ago

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

Dsolik commented 2 months ago

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

Dsolik commented 2 months ago

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'?

keithf4 commented 2 months ago

See the FAQ

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

keithf4 commented 2 months ago

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