Just like the title says. I am monitoring the pg_stat_activity table in my Postgres DB and trying to capture the behavior of my Tomcat JDBC connection pooling implementation. The idle connections that are opened on startup being returned to the pool is working as intended. I have my min-idle configuration set to 1, so I am trying to see if I can get more connections to open up by "overloading" the single idle connection that is still open.
In my testing, I turned off any caching so all requests will hit the DB. Not only can I not get another connection to open up by sending over 200 requests a second, but the single connection serving all of these just shows as idle state with "COMMIT" as the last query for the whole duration of requesting. I'm refreshing my query to pg_stat_activity once a second.
I'm willing to accept that maybe I just need more load to open a new connection, but why is this single connection never active even while using it? I see the state_change column update but I can't see the state itself actually update.
What I'm expecting is for the connection to show as active until it serves the last request, from which it will show idle after. Is this process just happening too fast to capture it given the fastest I can query pg_stat_activity is once a second?
Any help is appreciated. Thanks.