title: SQL Server - Merging large tables without locking the data
body: <p>I have a very large set of data (~3 million records) which needs to be merged with updates and new records on a daily schedule. I have a stored procedure that actually breaks up the record set into 1000 record chunks and uses the <code>MERGE</code> command with temp tables in an attempt to avoid locking the live table while the data is updating.  The problem is that it doesn't exactly help. The table still "locks up" and our website that uses the data receives timeouts when attempting to access the data. I even tried splitting it up into 100 record chunks and even tried a <code>WAITFOR DELAY '000:00:5'</code> to see if it would help to pause between merging the chunks. It's still rather sluggish.</p>
  
  <p>I'm looking for any suggestions, best practices, or examples on how to merge large sets of data without locking the tables.</p>
  
  <p>Thanks</p>