我想批量插入20000條記錄,代碼自爆:甲骨文ojdbc則ExecuteBatch太慢
while ((line = reader.readLine()) != null) {
line = line.substring(0, line.lastIndexOf(";"));
System.out.println(line);
st.addBatch(line);
i += 1;
if (i % 1000 == 0) {
System.out.println("execute:" + i);
Date beginBatch = new Date();
st.executeBatch();
Date endBatch = new Date();
System.out.println("Start at: " + beginBatch);
System.out.println("End at: " + endBatch);
}
}
,它tooks我一個小時完成,但是當我運行在SQL Developer控制檯這個SQL文件,它只花了我3分鐘。有什麼不對的嗎。有人能幫我找出根本原因。
3分鐘20萬記錄非常慢。 – BobC
如何提高性能? – user6807013