Skip to content
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

Executing a prepared statement creates prepared statement after 5 executions #9

Open
fritshoogland-yugabyte opened this issue Aug 12, 2021 · 0 comments
Assignees

Comments

@fritshoogland-yugabyte
Copy link

When a statement explicitly created as preparedStatement is executed, it will be executed as non-prepared statement for 5 times. After the fifth time, JDBC will create a server-side prepared statement. This behavior is controlled by the property prepareThreshold, which is set to 5 by default.

This is illogical behavior, if a statement is declared as prepared statement, it should result in a server-side prepared statement as well. Therefore my suggestion is to change the default threshold value to 1, so a server-side prepared statement is created together with the client-side prepared statement object.

By changing the default the behavior becomes more logical, and more efficient because when the java programmer intended to prepare a statement and bind and execute it multiple times, it will actually do that server side too. And the old behavior if needed can always be changed back by explicitly setting it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants