Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvOGB-0002kw-RX for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jul 2020 16:58:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jvOGA-00005E-EY for pgsql-hackers@arkaria.postgresql.org; Tue, 14 Jul 2020 16:58:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvOGA-0008WU-7X for pgsql-hackers@lists.postgresql.org; Tue, 14 Jul 2020 16:58:26 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jvOG7-0000fe-UG for pgsql-hackers@postgresql.org; Tue, 14 Jul 2020 16:58:25 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1jvOG6-0001ln-Ka; Tue, 14 Jul 2020 12:58:22 -0400 Date: Tue, 14 Jul 2020 12:58:22 -0400 From: Bruce Momjian To: Bharath Rupireddy Cc: PostgreSQL-development Subject: Re: [PATCH] postgres_fdw connection caching - cause remote sessions linger till the local session exit Message-ID: <20200714165822.GE7628@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Jul 14, 2020 at 03:38:49PM +0530, Bharath Rupireddy wrote: > Approach #4: > A postgres_fdw foreign server level option: connection idle time, the > amount of idle time for that server cached entry, after which the > cached entry goes away. Probably the backend, before itself going to > idle, has to be checking the cached entries and see if any of the > entries has timed out. One problem is that, if the backend just did it > before going idle, then what about sessions that haven't reached the > timeout at the point when we go idle, but do reach the timeout later? Imagine implementing idle_in_session_timeout (which is useful on its own), and then, when you connect to a foreign postgres_fdw server, you set idle_in_session_timeout on the foreign side, and it just disconnects/exits after an idle timeout. There is nothing the sending side has to do. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee