Home > Back-end >  SpringBoot mybatis BATCH mode bulk insert data, the efficiency is more and more slow
SpringBoot mybatis BATCH mode bulk insert data, the efficiency is more and more slow

Time:06-02

Post code first, normal BATCH model library,
Incoming data from the hornetq to read the message queue, about 1000 w
quantity of the dataData warehousing efficiency began 10000, about ; Put in storage, after millions of warehousing efficiency significantly lower, article 10000 data warehousing to 20000 ms

Personal speculation possible reasons: 1. The oracle database storage efficiency; 2. The hornetq queue backlog, not to be able to processing, lead to storage efficiency of slow (this will lead to warehouse slow?)
Turn to !!!!!!

Private void save (final List The orders) {
If (the orders==null | | the orders. The isEmpty ()) {
return;
}
SqlSession sqlSession=null;
DSOnlineOrderMapper mapper.
Try {
SqlSession=toFactory. OpenSession (ExecutorType. BATCH, false);
Mapper=sqlSession. GetMapper (DSOnlineOrderMapper. Class);
For (DSOnlineOrder dsPayOrder: the orders) {
Mapper. InsertSelective (dsPayOrder);
}
sqlSession.commit();
SqlSession. ClearCache ();
} the catch (Exception e) {
If (sqlSession!=null)
SqlSession. The rollback ();
Logger. The error (" save dspayorder error: ", e);
} the finally {
If (sqlSession!=null)
sqlSession.close();
}
}

CodePudding user response:




Warehousing contrast before and after the article number and storage time,,,

CodePudding user response:

Used to insert all try reference:
INSERT ALL
INTO TABLEAAA (C1, C2) values (# # {item. C1}, {item. C2})
SELECT * FROM dual

Refer to
The increases are: https://qiita.com/yang1005/items/951cb8bc5aff23e6355e
The increased no: https://qiita.com/yang1005/items/05488893fb3d4cfc58c0

CodePudding user response:

I also want to know why, batch mode when large amount of data, the slower the later
  • Related