SQL Performance (MOSC)

MOSC Banner

Update query running for long time

edited Aug 12, 2015 10:29AM in SQL Performance (MOSC) 2 commentsAnswered

Hi

I am running update query which is taking long time (approx 3 Hrs)

UPDATE MSTR_AFFILIATIONS PARTITION (PAR_FR) A

SET A.CUSTOMER_TYPE =

(SELECT /*+ PARALLEL(6) */

MAX (B.CUSTOMER_TYPE)

FROM MSTR_CUST PARTITION (PAR_FR) B

WHERE A.COUNTRY_ID = B.COUNTRY_ID

AND A.CHILD_ID = B.customer_id

AND B.CUSTOMER_TYPE IS NOT NULL)


I think oracle execute select subquery for each row in partition par_fr to update the column, thats why its taking time.


Is there any way we can rewrite this query and have less CPU COST.

As of now CPU cost is huge above 100K.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center