Take advantage of multiple cores executing SQL statements

Posted by willvv on Stack Overflow See other posts from Stack Overflow or by willvv
Published on 2009-03-31T18:51:08Z Indexed on 2012/08/30 21:38 UTC
Read the original article Hit count: 131

Filed under:
|
|

I have a small application that reads XML files and inserts the information on a SQL DB.

There are ~ 300 000 files to import, each one with ~ 1000 records.

I started the application on 20% of the files and it has been running for 18 hours now, I hope I can improve this time for the rest of the files.

I'm not using a multi-thread approach, but since the computer I'm running the process on has 4 cores I was thinking on doing it to get some improvement on the performance (although I guess the main problem is the I/O and not only the processing).

I was thinking on using the BeginExecutingNonQuery() method on the SqlCommand object I create for each insertion, but I don't know if I should limit the max amount of simultaneous threads (nor I know how to do it).

What's your advice to get the best CPU utilization?

Thanks

© Stack Overflow or respective owner

Related posts about sql

Related posts about insert