I have a huge table (3 billion rows), which, unfortunately, contains mostly expired data. I want to just delete all these expired lines and save the rest.
I can execute the statement as follows:
delete from giganticTable where exp_date < getDate()
The execution plan somehow estimates that about 400 million rows will be deleted.
When executed, not only does this end in an hour, but the database transaction log file also grows from 6 to 90 GB. Note that the database was in a volume log recovery model while this was happening. In the end, I canceled this request, as I am sure there should be a better way to do this.
I have several tables for which I need to perform a similar operation. What is the fastest and most effective way to simply delete these lines if I have absolutely no desire to restore them?
Please note that I am using Microsoft SQL Server 2005.
polygenelubricants
source share