You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I had a question concerning the behavior when connections are returned to the pool. For background, we are working with Java 21, HikariCP 5.0.1, and PostgreSQL 15.5
In our application, we make prepared statements such as "SET statement_timeout=xxx" when we first retrieve a connection from the pool. We found we were executing these a lot and wanted to cut down, so we cached the previously executed timeout values on the clientInfo Property on the connection. When getting a new connection from the pool, if we see that the timeout values have already been cached on it's clientInfo, we won't run the query again. We had been assuming that a connection in the pool will not have its session and session settings reset, so that is how we arrived at the solution of not running the query again, since we thought the values would still be on the connection.
What we are finding is that either our assumption is wrong or we misconfigured something. When we get a connection back from the pool that has had its clientInfo modified and immediately query for the timeout values, we see that they are 0 instead of the previously set value. What we want to know is if these values are being reset every time we get the connection from the pool or put it back, or if we misconfigured something somewhere.
I have looked at resetConnectionState() but that only seems to reset the properties of the connection, not settings that would be in the database, but please correct me if wrong.
The text was updated successfully, but these errors were encountered:
Hello, I had a question concerning the behavior when connections are returned to the pool. For background, we are working with Java 21, HikariCP 5.0.1, and PostgreSQL 15.5
In our application, we make prepared statements such as "SET statement_timeout=xxx" when we first retrieve a connection from the pool. We found we were executing these a lot and wanted to cut down, so we cached the previously executed timeout values on the
clientInfo
Property on the connection. When getting a new connection from the pool, if we see that the timeout values have already been cached on it'sclientInfo
, we won't run the query again. We had been assuming that a connection in the pool will not have its session and session settings reset, so that is how we arrived at the solution of not running the query again, since we thought the values would still be on the connection.What we are finding is that either our assumption is wrong or we misconfigured something. When we get a connection back from the pool that has had its
clientInfo
modified and immediately query for the timeout values, we see that they are 0 instead of the previously set value. What we want to know is if these values are being reset every time we get the connection from the pool or put it back, or if we misconfigured something somewhere.I have looked at
resetConnectionState()
but that only seems to reset the properties of the connection, not settings that would be in the database, but please correct me if wrong.The text was updated successfully, but these errors were encountered: