3

Sigh. I've been searching forever for this and, as usual, find nothing.

I'm not talking about the "connection timeout" for how long it waits before giving up when trying to connect to the database. I'm talking about how long a database connection can be "idle" without any queries being executed (and no pg_pings) before it's considered abandoned and force-closed.

Which setting controls this, and how do I retrieve it?

2 Answers 2

3

Before 9.6, no such timeout exists in PostgreSQL. Thereafter, it only exists if you are idle in the middle of a transaction.

show idle_in_transaction_session_timeout;

Note however that any router, gateway, or firewall between you and the server can nuke your connection at any time it chooses. TPC keepalives may or may not dissuade them. PostgreSQL can't offer much insight into what your networking equipment does.

1

since v14 we have also

SHOW idle_session_timeout

see https://pgpedia.info/i/idle_session_timeout.html

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.