Deleting Orphaned Records Taking Forever
Posted on 2011-09-05
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:
From FactTransaction t1 Left Join CleanTransaction t2 On t1.TransactionId = t2.DONATION_ID Where t2.DONATION_ID is null
Any help is appreciated.