agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-jdbc@postgresql.org
Cc: pgadmin-support@postgresql.org
Cc: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: Idle connections / sessions
Date: Wed, 12 Dec 2018 10:55:22 +0100
Message-ID: <puqlq7$rlc$1@blaine.gmane.org> (raw)
In-Reply-To: <HE1PR0402MB3625F9C2E5735459D63DA27C93A70@HE1PR0402MB3625.eurprd04.prod.outlook.com>
References: <HE1PR0402MB3625F9C2E5735459D63DA27C93A70@HE1PR0402MB3625.eurprd04.prod.outlook.com>

Oygun Josef schrieb am 12.12.2018 um 10:37:
> Is it possible to terminate idle connections/sessions automatically
> through a timeout in AWS or do I need to run a periodical cron job
> for this?
> 
> Postgres version: 9.6.6 Instance: db.t2.micro RAM : 1GB
> 
> We are running a microservice architecture using docker with
> kubernetes and I can see that every pod on every node that has
> connected to the DB still has a idle connection as long as the node
> is still active even.

An "idle" connection isn't really a problem. 

Long running "idle in transaction" session are a problem however. 

To cope with them, you could use idle_in_transaction_timeout: 

    https://www.postgresql.org/docs/current/runtime-config-client.html#GUC-IDLE-IN-TRANSACTION-SESSION-T...

> It is both PGAdmin and the PostgreSQL JDBC Driver that leaves open
> idle connections.

The JDBC driver does not leave any connections "open" or "idle"
It's the application that uses the driver that fails to close them. 

Maybe you need to configure your connection pool to release connections when they are idle.

Thomas





view thread (5+ messages)  latest in thread

Message-ID: <puqlq7$rlc$1@blaine.gmane.org>
Permalink:  ../puqlq7$rlc$1@blaine.gmane.org/
Also on:    postgresql.org/message-id/puqlq7$rlc$1@blaine.gmane.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: spam_eater@gmx.net, pgsql-jdbc@postgresql.org, pgadmin-support@postgresql.org, pgsql-general@postgresql.org
  Subject: Re: Idle connections / sessions
  In-Reply-To: <puqlq7$rlc$1@blaine.gmane.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox