I currently use the native foreign data wrapper extension to connect to some other postgres instances (sharding architecture). Now I would like to understand how those underlying outgoing connections are managed by the fdw
. I read in the documentation that libpq
is used to handle the connections. There is no connection pooling in place but those connections are cached.
This connection is kept and re-used for subsequent queries in the same session.
I would like to list those connections to monitor those? We can list incoming connections via SELECT * FROM pg_stat_activity;
- can we do something similar for outgoing connections?
The connections to the foreign server are kept open until the database session ends. To monitor that, set
log_connections
andlog_disconnections
toon
on the target PostgreSQL server.