insert batch & execute performance
Posted by: Globe Trotter
Date: February 27, 2020 02:44AM

Hi,

I have
- a table about 100MB size
- and try addBatch inserts around 1MB each time
- "?rewriteBatchedStatements = true" is to login added
- @@global.max_allowed_packet = 256000000
- @@global.key_buffer_size = 256000000;
- Code in Java:
conn.setAutoCommit(false);
String query = "insert into " + TABLE + " (id, partInfo) values (?, ?)";
PreparedStatement pstmt = conn.prepareStatement(query);

for(..)
{
pstmt.setInt(ID, jdosym.getId());
pstmt.setBytes(PART, jdosym.getPart());
pstmt.addBatch();

if (i % 1000 == 0) pstmt.executeBatch();
}

pstmt.executeBatch();
conn.commit();
conn.setAutoCommit(true);

pstmt.close();

The Problem is, the execute batch is very very slow!? What can be the reason?

Thanks in advamce,

GlobeTrotter

Options: ReplyQuote


Subject
Written By
Posted
insert batch & execute performance
February 27, 2020 02:44AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.