On Tue, Jun 30, 2020 at 12:23:28PM +0900, Masahiko Sawada wrote: > > I propose to have a new session level GUC called > > "enable_connectioncache"(name can be changed if it doesn't correctly > > mean the purpose) with the default value being true which means that > > all the remote connections are cached. If set to false, the > > connections are not cached and so are remote sessions closed by the local > > backend/session at > > the end of each remote transaction. > > I've not looked at your patch deeply but if this problem is talking > only about postgres_fdw I think we should improve postgres_fdw, not > adding a GUC to the core. It’s not that all FDW plugins use connection > cache and postgres_fdw’s connection cache is implemented within > postgres_fdw, I think we should focus on improving postgres_fdw. I > also think it’s not a good design that the core manages connections to > remote servers connected via FDW. I wonder if we can add a > postgres_fdw option for this purpose, say keep_connection [on|off]. > That way, we can set it per server so that remote connections to the > particular server don’t remain idle.
I thought we would add a core capability, idle_session_timeout, which would disconnect idle sessions, and the postgres_fdw would use that. We have already had requests for idle_session_timeout, but avoided it because it seemed better to tell people to monitor pg_stat_activity and terminate sessions that way, but now that postgres_fdw needs it too, there might be enough of a requirement to add it. -- Bruce Momjian <br...@momjian.us> https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee