Hi experts,
I have a job that most of the times takes seconds, but sometimes takes 40, 50 minutes to run…
I am pretty sure is because of a blocking…
The code has a couple of selects and then:
updateSF_Opportunity
set lastopportunitystageID=d.OpportunityStageID,
LastOpportunityStageUpdateDate =LastOppUpdate,
LastOpportunityStageInsertDate =LastOppInsert
from #LastOpportunityDatad
join SF_Opportunityso
on d.OpportunityID=so.OpportunityID
where isnull(so.LastOpportunityStageID, 0)<>d.OpportunityStageID
I suspect this Update gets blocked and sometimes waits for minutes…
I am thinking of updating the SP and putting a getdate() before the update and after and save those values to a table…. So I will confirm is this the root cause… Thoughts?