-
Notifications
You must be signed in to change notification settings - Fork 184
Capability to disable prepared statement caching #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
One note: pgjdbc handles errors "prepared statement does not exist" and retries the whole process even when caching enabled. I'm not sure that poolers are the reason of this behaviour though. |
Documentation is wrong in README and mentions -1 to disable instead of 0:
Documentation in code looks correct:
|
Good catch, that's fixed now. |
Hmmmm.... prepareThreshold=0 doesn't explicitly disable the cache preparedStatementCacheQueries=0 does that. |
Added preparedStatementCacheQueries parameter, which controls cache behaviour. When cache limit is reached last used statement is closed before parsing new one. When cache limit is 0 caching of statement is disabled and unnamed statements are used in extended message flow. Negative values stand for IndefiniteStatementCache (default one). [#223][#225][#277]
So when using Postgres with connection poolers like pgbouncer one might end up in a situation where you have to disable prepared statement caching. This is what Postgres JDBC driver allows if you set
prepareThreshold=0
in connection string. As far as I can see from source code that is not possible today. Can we enable similar mechanism withpreparedStatementCache=0
; alternatively this will allow developers controlling cache size. JDBC has similar optionpreparedStatementCacheQueries
I hope we can do something similar.The text was updated successfully, but these errors were encountered: