Re: Idle connections / sessions

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: pgadmin-support(at)postgresql(dot)org,pgsql-sql(at)postgresql(dot)org,pgsql-general(at)postgresql(dot)org
Subject: Re: Idle connections / sessions
Date: 2018-12-12 09:55:22
Message-ID: puqlq7$rlc$1@blaine.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-general pgsql-jdbc pgsql-sql

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-TIMEOUT

> 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

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Fabio Pardi 2018-12-12 10:02:38 Re: Idle connections / sessions
Previous Message Oygun Josef 2018-12-12 09:37:30 Idle connections / sessions

Browse pgsql-general by date

  From Date Subject
Next Message Fabio Pardi 2018-12-12 10:02:38 Re: Idle connections / sessions
Previous Message Oygun Josef 2018-12-12 09:37:30 Idle connections / sessions

Browse pgsql-jdbc by date

  From Date Subject
Next Message Fabio Pardi 2018-12-12 10:02:38 Re: Idle connections / sessions
Previous Message Oygun Josef 2018-12-12 09:37:30 Idle connections / sessions

Browse pgsql-sql by date

  From Date Subject
Next Message Fabio Pardi 2018-12-12 10:02:38 Re: Idle connections / sessions
Previous Message agharta82@gmail.com 2018-12-12 09:49:46 Re: Group by column alias where same-column-name already exists