title: Deletion of rows in table cause LOCKS
body: <p>I am running the following command to delete rows in batches out of a large table (150 million rows):</p>
  
  <pre><code>DECLARE @RowCount int
  WHILE 1=1
      BEGIN
          DELETE TOP (10000) t1
          FROM table t1
          INNER JOIN table2 t2 ON t2.PrimaryKey = t1.PrimaryKey
          WHERE t1.YearProcessed &lt;= 2007
  
          SET @RowCount = @@ROWCOUNT
  
          IF (@RowCount &lt; 10000) BREAK
      END
  </code></pre>
  
  <p>This table is HIGHLY used.  However, it is deleting records, but it is also causing locking on some records, thus throwing errors to the user (which is not acceptable in the environment we're in).</p>
  
  <p>How can I delete older records without causing locks?  Should I reduce the size of the batch from 10000 records to 1000?  How will this effect log sizes (we have very little hard drive space left for large log growth).</p>
  
  <p>Any suggestions?</p>