ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ming Xue <ming....@plateau.com>
Subject RE: Am I doing anything wrong? iBATIS has very poor performance o n batch inserts compared to JDBC.
Date Thu, 09 Jun 2005 18:11:44 GMT
Has anybody else done such test? This can be an important issue.

-----Original Message-----
From: Dmitry Skavish [mailto:skavish@gmail.com]
Sent: Thursday, June 09, 2005 1:50 PM
To: ibatis-user-java@incubator.apache.org; Bing Zou
Subject: Re: Am I doing anything wrong? iBATIS has very poor performance
on batch inserts compared to JDBC.


May be you have to wrap it into transaction?

On 6/9/05, Bing Zou <xiguamaillist@gmail.com> wrote:
> Am I doing anything wrong? Why iBATIS is so slow compared to JDBC?
> Thanks.
>
----------------------------------------------------------------------------
-----------------------------
> Using iBATIS to insert 1000 records: (38375 ms)
>             sqlMap.startBatch();
>             Map args = CollectionUtil.createMap(2);
>             for(int i=0;i<p_resultList.size();i++){
>                 AdvancedSearchResultData resultData =
> (AdvancedSearchResultData)p_resultList.get(i);
>                 args.put("RESULT_DATA", resultData);
>                 args.put("UserIdentifier", p_userID);
>                 sqlMap.insert("insertIntoTempTable", args);
>             }
>             sqlMap.executeBatch();
> 
>         INSERT INTO TEMPTABLE (ORDER_NUMBER, RESOURCE_ID,
> RESOURCE_TYPE_ID,USER_ID, ATTACHMENT_ID)
>         VALUES ( #RESULT_DATA.relevance#,
>                  #RESULT_DATA.resourceIdentifier.ID#,
>                  4,
>                  #UserIdentifier.ID#,
>                  #RESULT_DATA.attachmentIdentifier.ID# )
> 
>
----------------------------------------------------------------------------
-----------------------------
> Using JDBC to insert the same 1000 records (391 ms)
>             statement = connection.prepareStatement( ""INSERT INTO
> TEMP_FTS(ORDER_NUMBER,  RESOURCE_ID,
> RESOURCE_TYPE_ID,USER_ID,ATTACHMENT_ID) " +
>         "VALUES ( ?,?, 4, ?, ?)" );
>             for(int i=0;i<p_resultList.size();i++){
> 
>                 AdvancedSearchResultData resultData =
> (AdvancedSearchResultData)p_resultList.get(i);
>                 statement.setLong( 1, i );
>                 statement.setLong( 2, resultData.getResourceId() );
>                 statement.setLong( 3, p_userID.getID() );
>                 statement.setLong( 4, resultData.getAttachmentId() );
> // attachment_id
>                 statement.addBatch();
>             }
>             statement.executeBatch();
> 


-- 
Dmitry Skavish

Mime
View raw message