Sql Update from another table performance
513042Jul 7 2008 — edited Jul 7 2008Hello I have the following query.
The subquery takes 2 mins if ran alone.
When I try to update off it , the process takes 30mins.
Is the subquery being executed for each row to update?
Please help
UPDATE TARGETS_TOLLFREE T3
SET MINS =( SELECT mins
FROM (SELECT ORIGINATION_LATA,ORIGINATION_OCN,
ROUND(SUM(INDURATION / 60) * 31* 1.3,0) AS MINS
FROM TSM_CDRS.CDRS_NACT T2
WHERE calldate BETWEEN TRUNC(SYSDATE) -1 AND TRUNC(SYSDATE)
AND REGEXP_LIKE('800;888;866;877;855',SUBSTR(DNIS,1,3))
GROUP BY ORIGINATION_LATA,ORIGINATION_OCN) T2
WHERE t3.lata = t2.ORIGINATION_lata
AND t3.ocn = t2.ORIGINATION_OCN)