Hello,
I’ve read in the documentation that I can speed up large imports to H2
database by setting variables LOCK_MODE, LOG, etc.
Here a simple test that inserts data to an H2 table:
Connection conn = DriverManager.getConnection("jdbc:h2:c:/java/test/
files/temp/temp",
"sa", "");
Statement st = conn.createStatement();
st.execute("SET CACHE_SIZE 65536");
st.execute("SET LOCK_MODE 0");
st.execute("SET LOG 0");
st.execute("SET UNDO_LOG 0");
st.execute("CREATE TABLE TEST(ID INT, STR VARCHAR(20))");
PreparedStatement pst = conn.prepareStatement("INSERT INTO TEST
VALUES(?,?)");
for (int i = 0; i < 1000000; i++) {
pst.setInt(1, i);
pst.setString(2, "Value " + i);
pst.execute();
}
Are there any H2 options or mechanisms else that can increase the
performance for bulk insertions?
--
Best regards,
Serg
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.