You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2016/12/12 20:33:58 UTC

[jira] [Commented] (DBUTILS-131) Speedup query calls without parameters

    [ https://issues.apache.org/jira/browse/DBUTILS-131?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15743067#comment-15743067 ] 

Michael Osipov commented on DBUTILS-131:
----------------------------------------

Shalom Yair, this idea sounds interesting. I am interested to see your patching idea, moreover do you think we can reproduce this on Oracle too? I have a big machine at hand to torture an Oracle database.

> 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
>
> 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
(v6.3.4#6332)