Hi guys. I have four similar queries like this. I just cut off I don’t why but this query is an expensive query. It takes like 20 minutes to be executed. To your info, the two tables participating in this and the other queries were heaps. What would be the reason? Is there other mechanism to optimize this query? I am wondering any one could lend me a hand. Do you think adding a constraint or creating a clustered index would improve the performance?
UPDATEdbo.tbl_cal_db
SETPAY = (
SELECT isnull(sum(coc), 0)
FROM ##tempa AS aod
WHERE aod.agent IN (
95
,206
)
AND aod.midnight = h.midnight
AND aod.callservice = h.service
AND aod.callhour = h.CallHour
AND aod.calltz = h.TZ
AND aod.ac = h.st
GROUP BY midnight
,callhour
,callservice
,calltz
,ac
)
FROM##tempa
,dbo.tbl_cal_db AS h
No comments:
Post a Comment