-
Notifications
You must be signed in to change notification settings - Fork 435
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
SQLServerResultSet.findColumn(String columnName) should cache result #1055
Comments
Hi @stulscott, please feel free to create a PR against the repo and the team will review it in the near future. |
Hi @stulscott, #1066 attempts to address this issue, please take a look to see if it's within expectations or even feel free to review it. |
#1066 appears to only affect SQLServerCallableStatement. SQLServerResultSet.findColumn() still iterates through all columns on every call. |
Hi @stulscott, I took a look at the implementation for
There are also other open ended implementation decisions that impact the performance such as:
I'd like your opinion on the points above and on what solution you envisioned when creating the issue. |
Hi @rene-ye. I've attached a patch. Hopefully that answers your questions. Essentially you just cache the column name provided. Yes if the caller passes the column name with different cases it will be cached multiple times but that would seem a very unlikely scenario. There is a small cost to creating the hash map and caching the discovered indices but that will only be a problem if there is only one row in the result set. As soon as there are multiple rows and multiple columns being referenced by name, caching the indices drastically improves performance. In fact this is the main reason why I use JTDS instead of this driver. |
Hi @stulscott, I've applied the changes you've requested to the PR, and the team will review whether it'll be merged. Please feel free to make comments/review the PR if something stands out to you. |
#1066 merged. |
The performance of retrieving a value from SQLServerResultSet by column name could be vastly improved by caching the result of the findColumn(columnName) method. Since this is such a simple to implement but hugely beneficial change I am curious if there is a reason why this has not yet been implemented. I am happy to create a patch if it is agreed by the community here that it is desirable to add this feature to the driver.
The text was updated successfully, but these errors were encountered: