如果我有一张包含大量数据的表格...如果我进行增量删除而不是“一次性删除”...有什么好处?
一次性删除
DELETE table_1
WHERE BID = @BID
AND CN = @CN
AND PD = @PD;
Incremental Delete
While (1=1)
Begin
DELETE TOP (100000) FROM table_1
WHERE BID = @BID
AND CN = @CN
AND PD = @PD;
If @@rowcount = 0 -- No row affected.
BREAK
ELSE
Continue
End
我从删除 SQL Server 表中的数据需要很长时间中获得了帮助。