Programming :  Student Freelance Forum For Work Experience Builders' (CertificationPoint) The fastest message board... ever.
 
Strategies to delete most of the data from large table in SQL Server
Posted by: adcertpoint (Moderator)
Date: July 22, 2021 07:16PM

I need to delete 90% of a table.

I am executing this statement in a loop (to keep the transactions small)

DELETE TOP(1000)
FROM Events
WHERE EventID IN (SELECT EventId FROM EventsToDelete)

Both tables have about 50 million rows.

Query plan for this statement is two index scans and this is not fast. What strategies could I employ to make this whole process faster ?

Other tables have FK references to this table.

Options: ReplyQuote


Sorry, only registered users may post in this forum.
This forum powered by Phorum.