ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Larry Meadors <larry.mead...@gmail.com>
Subject Re: Am I doing anything wrong? iBATIS has very poor performance on batch inserts compared to JDBC.
Date Thu, 09 Jun 2005 18:38:37 GMT
I have used iBATIS for a cpouple of years now, and have not once seen
this sort of performance issue.

What is the database? what is the connection pooling mechanism? What
type is th Map that is getting returned?

Give us some more context...

Larry


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();
>

Mime
View raw message