5

I’m running sql server 2012 and the installed ram on that machine is 128 GB. The performance of the bulk insert is very low. The bulk insert of 10 million records takes about 2 hours. We have checked the cpu, disk io, memory and everything seems to be ok. I’ve just checked the wait_type and found out the CXPACKET wait_time_ms is 79346890761 and max_wait_time_ms is 2164694 and signl_wait_time_ms 2849080871. Are these numbers too high and could it be the reason for slow performance? The degree of parallelism is set to 0.

Colin 't Hart
9,51015 gold badges37 silver badges44 bronze badges
asked Apr 11, 2013 at 19:02

1 Answer 1

7

Below are some good ways to improve BULK INSERT operations :

  1. Using TABLOCK as query hint.
  2. Dropping Indexes during Bulk Load operation and then once it is completed then recreating them.
  3. Changing the Recovery model of database to be BULK_LOGGED during the load operation.
  4. If the target has Clustered Index then specifying ORDER BY clause in the bulk insert operation will increase the speed of BULK loading.
  5. Using Trace Flag 610 at the beginning of BULK INSERT operation.

The max degree of parallelism should be configured on the server rather than the default. You can refer to my answer on how it configure it here.

Some good reference with interesting stats are given in The Data Loading Performance Guide here . Have a Look at BATCHSIZE and ROWS_PER_BATCH as well in the guide.

answered Apr 11, 2013 at 19:21
2
  • Trace Flag 610 is on by default for SQL Server 2016+ when ALLOW_PAGE_LOCKS is ON for the indexes see docs Commented Jul 7, 2020 at 8:37
  • OP has a tag of SQL server 2012. this is good info though. Commented Jul 7, 2020 at 11:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.