PostgresDB 25P03: Idle in Transaction Session Timeout

Transaction session timed out due to idleness.
  1. Identify the offending transaction/query causing the timeout by checking the current activity in the database:
  2. SELECT pid, usename, application_name, state, query, state_change FROM pg_stat_activity WHERE state = 'idle in transaction';
  3. Terminate the idle transaction using the PID obtained from the above query:
  4. SELECT pg_terminate_backend(<pid_here>);
  5. Review application logs connected to the PostgreSQL database for any transactions that were not properly closed or committed. This can help identify the part of your application responsible for the issue.
  6. Adjust the idle_in_transaction_session_timeout setting to a suitable value, if necessary, based on the investigation findings to prevent future occurrences:
  7. ALTER SYSTEM SET idle_in_transaction_session_timeout = '5min';
  8. Followed by reloading the configuration:
  9. SELECT pg_reload_conf();

Master

PostgresDB

in Minutes — Grab the Ultimate Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Real-world configs/examples
Handy troubleshooting shortcuts
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

PostgresDB

Cheatsheet

(Perfect for DevOps & SREs)

Most-used commands
Your email is safe with us. No spam, ever.

Thankyou for your submission

We have sent the cheatsheet on your email!
Oops! Something went wrong while submitting the form.

MORE ISSUES

Made with ❤️ in Bangalore & San Francisco 🏢

Doctor Droid