Fastest way for inserting very large number of records into a Table in SQL

Posted by Irchi on Stack Overflow See other posts from Stack Overflow or by Irchi
Published on 2010-05-04T14:15:33Z Indexed on 2010/05/04 14:18 UTC
Read the original article Hit count: 187

The problem is, we have a huge number of records (more than a million) to be inserted into a single table from a Java application. The records are created by the Java code, it's not a move from another table, so INSERT/SELECT won't help.

Currently, my bottleneck is the INSERT statements. I'm using PreparedStatement to speed-up the process, but I can't get more than 50 recods per second on a normal server. The table is not complicated at all, and there are no indexes defined on it.

The process takes too long, and the time it takes will make problems.

What can I do to get the maximum speed (INSERT per second) possible?

Database: MS SQL 2008. Application: Java-based, using Microsoft JDBC driver.

© Stack Overflow or respective owner

Related posts about Performance

Related posts about sql-server