You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2013/09/09 13:46:52 UTC

[jira] [Commented] (DERBY-6339) PreparedStatement resultset.next performance problem

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

Knut Anders Hatlen commented on DERBY-6339:
-------------------------------------------

It's difficult to help with this issue without more information, such as the exact queries and the schema of the tables involved.

Most queries perform little work when executeQuery() is called and delay most of it until the first time next() is called, so it's not uncommon that executeQuery() is fast and the first call to next() takes some time.
                
> PreparedStatement  resultset.next performance problem
> -----------------------------------------------------
>
>                 Key: DERBY-6339
>                 URL: https://issues.apache.org/jira/browse/DERBY-6339
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.8.1.2
>         Environment: Win7 32bit,JDK1.7u21
>            Reporter: leolee
>
> There is a table with 100,000 records,when I use PreparedStatement query from it,the query is fast and just cost 200ms. But the problem is when I fetch data from ResultSet,It's slow,takes about 1500 ms,but it's only 7 records in the resultset. The first 7 records is fast,I think it should break the loop when all the 7 records have fetched completely,but it's not,the last excution of "resultset.next()" takes more than 1400ms. 
> While on the other hand,I change to use Statement instead of PreparedStatement,when all 7 records have fetched out,the loop break immediately,plus the query time,all takes less than 200ms. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira