troubleshooting Question

Deleting Orphaned Records Taking Forever

Avatar of JLEmlet
JLEmlet asked on
Microsoft SQL Server 2008
26 Comments1 Solution368 ViewsLast Modified:
I have two tables that contain essentially the same information.  One is the staging table where data is transferred from the production database into the data warehouse.  The second table is the Fact table in the data warehouse.  The first step is to delete out any orphaned records in the Fact table - these being records that were deleted from the production table.  Each table has about 24,000,000 rows.  The ID column is indexed on both tables.  The query I'm using to delete is:

Delete t1
From FactTransaction t1 Left Join CleanTransaction t2 On t1.TransactionId = t2.DONATION_ID Where t2.DONATION_ID is null

Any help is appreciated.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 26 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 26 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros