Thank you for the feedback. I’ll check and see if the Query Optimizer recommends anything.
I did not get any recommendation for a new index. Furthermore, I realized that there is already an index for the field I was going to make one… it’s just not named the same as the field so I didn’t realize it. It’s called IX_PartDtl_TFLine and I was expecting IX_PartDtl_TFLineNum. So that’s out of the equation now also. I’ve got an active support ticket with EpicCare. We’re checking to see if there’s bad data in our system. Orphaned records, etc.
I’ll be interested to hear how it goes @dr_dan . Good luck!
One thing I noticed that is different in my case than in yours - my query that is stuck is this (has plant references also):
delete a
from Erp.TFOrdDtl a
inner join Erp.PartDtl c on
a.Company = c.Company
and a.TFLineNum = c.TFLineNum
and a.Plant = c.Plant
inner join Erp.JobHead b on
c.Company = b.Company
and c.JobNum = b.JobNum
and b.JobClosed = 0
and b.JobFirm = 0
where
b.Company = @Company
and b.Plant = @Plan