Postgres sessions idle with request = COMMIT or ROLLBACK

I have a Postgres 9.5 database for a Java web application. Sometimes, the number of sessions will suddenly spike due to a long request, and those sessions are not immediately cleaned up. When I check pg_stat_activity, the query column shows COMMIT or ROLLBACK with idle stage. This causes Postgres to hit high max_connections thresholds, which can lead to a production outage.

request | ROLLBACK condition | idle account | 167

request | COMMIT state | idle account | 280

  • What are these COMMIT / ROLLBACK sessions idle?
  • How can I delete these unoccupied sessions immediately?
  • How can I reduce the number of these idle sessions from being created?

thank

+3


source to share


1 answer


These are connections awaiting another request. They don't do anything. That's why they are idle.

Your application uses a connection pool to avoid having to constantly disconnect and reconnect. If it has more connections than active requests, some will be idle and the specified request will be the last completed request.



This is all normal and nothing to worry about. You don't need to change or fix anything.

+5


source







All Articles