1

Let's say I have two related tables, Account and User, where User holds a foreign key to Account. I have 2,000 Accounts, and need to copy 10,000 users from one Account to other 1,999 Accounts. So all data goes to the User table. I've queried the 10,000 Users that needs to be copied. Now I have to insert them in the User table. So that's a count of (10000 x 1999 =) 199,90,000 rows.

I'm planning to use multiple threads for the insert operation. I need to know how SQL Server handles concurrent request -

  • Does it uses multiple connections, one for each thread?
  • How does it insert data to the same table as multiple threads provide them concurrently?
  • Since the User table has an Identity column, the insert operation can never be truly concurrent. But can this approach of using multiple threads from the client end achieve any performance gain at all?
  • What is a better scalable and faster way to perform this operation?

Thanks in advance.

EDIT : I'm using Entity Framework 4.0, which actually doesn't have support for bulk copy :(

4

0 回答 0