0

In my system I found same query called more than 30 times 'idle in transaction' state. Is there any way to to identify the reason of 'idle in transaction'? Should I terminate those query manually using pg_terminate_backend() or set idle_in_transaction_session_timeout to 5min in case of high TPS DB.

I think there is no meaning to ideal any query more than 24hr. But there I found it is more than 7 days.

Query below:

SELECT current_setting('transaction_isolation');

Query Output: read committed

How to debug in those type of issue to identify actual cause of 'idle in transaction'?

asked Apr 17, 2024 at 9:37
0

1 Answer 1

1

There are two things here that need to happen:

  1. You need to set your idle_in_transaction_session_timeout to a reasonable value. That greatly depends on the application that uses the database. As Laurenz commented, 5 minutes seems reasonable start.
  2. You have to contact the developers of that application, mention the query in question. They will eventually run out of resources on their side if they do not close connections.
answered Apr 18, 2024 at 6:04

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.