Take Care When Scripting Batches for Long Running Query
Source: https://michaeljswart.com/2014/09/take-care-when-scripting-batches/ The Straight Query Suppose we want to remove sales data from FactOnlineSales for the “Worcester Company” whose CustomerKey = 19036. That’s a simple delete statement: DELETE FactOnlineSales WHERE CustomerKey = 19036; This delete statement runs an unacceptably long time. It scans the clustered index and performs 46,650 logical reads and I’m worried about concurrency issues. Naive... » read more