Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Somebody explain Checkpoint to me

$
0
0
I'm using the below SQL to delete about 110million rows in batches of 100,000It's working fine in that if I stop the script, everything up to that point stays deleted.The problem I have is that twice now, the transaction log has filled up, killed the script, and SQL has rolled back further than just the last 100,000 rows.I thought that by issuing a CHECKPOINT, all dirty pages were written to disk and the trans log was truncated so I'm confused why the log is still filling up. The DB is in Simple Recovery mode. Does anyone have any advice?SET NOCOUNT ON; DECLARE @r INT; SET @r = 1; WHILE @r > 0BEGIN BEGIN TRANSACTION; DELETE TOP (100000) FROM tablename WHERE datefield < '2008-06-21 00:00:00'; SET @r = @@ROWCOUNT; COMMIT TRANSACTION; CHECKPOINT;END

Viewing all articles
Browse latest Browse all 3145

Trending Articles