I have a query that looks like this:
DELETE FROM dbo.fact_EmailActivity
WHERE wk_EmailActivity IN (SELECT wk_EmailActivity FROM stg_fact_emailActivity_process)
There are several problems, the table has more than 250M rows, 10 columns, 9 non clustered index and one clustered index (PK)
Is it better for me to do a delete based on a join? or use the sub query?
aslo, should i drop all the index and recreate ?
One thing i didn't mention, is that i execute this inside of an ssis pacakge loop, so i do it 100,000 rows at a time, then get the next 100K
It's taken over 23 hours, and it looks like it's doing about 1M rows per hour.there are a few other steps in the package, however, i'm positive that this is the biggest bottle neck .I don't know why the table was designed with so many indices. However, it seems like even if i drop the indices, rebuilding them, would take equally as long....
Any help, greatly appreciated, to even cut this time in half....