You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Carl Franklin Hall (Jira)" <ji...@apache.org> on 2020/01/05 00:16:00 UTC
[jira] [Resolved] (DBUTILS-131) Speedup query calls without
parameters
[ https://issues.apache.org/jira/browse/DBUTILS-131?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Carl Franklin Hall resolved DBUTILS-131.
----------------------------------------
Fix Version/s: 1.8
Resolution: Fixed
I adapted the patch to the latest code, and updated inserts and updates to use the same pattern.
> Speedup query calls without parameters
> --------------------------------------
>
> Key: DBUTILS-131
> URL: https://issues.apache.org/jira/browse/DBUTILS-131
> Project: Commons DbUtils
> Issue Type: Improvement
> Affects Versions: 1.6
> Reporter: Yair Lenga
> Priority: Major
> Fix For: 1.8
>
> Attachments: NewQueryRunner.java, QueryRunner-query.java
>
>
> The current 'query' methods takes sql (with ? placeholders), and list of parameters to fill the place holders. The implementation is using a prepared statement to speed up the call.
> I've observed that for statements without any ? placeholders, performance can be improved by using the statement interface. Using this path eliminate extra roundtrip and work that is needed to create the prepared statement (I believe it's implemented - on Sybase - as light weight stored proc).
> My proposal: modify the code in the method that implement the query:
> private <T> T [More ...] query(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params)
> and use 'Statement', instead of preparedStatement if there are no params (params == null || params.size() == 0 )
> In my application, large number of (parameter-less) SQL statement are generated on-the-fly, and the result set is converted to BeanList. We measured 50% speedup using statements, instead of prepared statements for this case.
> We will be happy to submit a fix or help with testing.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)