Trying to debug a connection leak in postgres database instance in RDS

SELECT * FROM pg_stat_activity;

Running the above query shows around 500 sessions, but all of them have wait_event_type Client and wait_event ClientRead. Also all of them have state as Idle. Are these sessions problematic or benign? Btw when I ran the query there was no issues of connections not available. May be I need to run this query when experiencing connection issues. But wanted to make sure whatever I am see now points towards any issues.

  • 1
    Use the rest of the columns in pg_stat_activity to see where they came from, who they came in as, and what is the last query they did before going idle.
    – jjanes
    Jan 17, 2022 at 2:45
  • @jjanes this was indeed a case of app leaking a connection, in the event of a failure. Finally root caused though it took a couple of hours. Thanks!
    – 1987frank
    Jan 18, 2022 at 21:38


Your Answer

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

Browse other questions tagged or ask your own question.