SQL Language (MOSC)
MOSC Banner

SQL Update:Multi column update with subquery factoring very slow

edited Jun 19, 2015 9:31PM in SQL Language (MOSC) 4 commentsAnswered ✓

Hi ,

I have a query which is structured like following,

update tab1 t1

set (c1,c2,c3) =

(

          select c1,c2,c3

          from

                    (

                              with sq1 as (

                                        select ... from tab1 join tab2 ..etc

                                   ),sq2 as (

                                         select ...

                                   )

                                   select

                                                 

                                   from    sq2

                     ) u1

                    where u1.c4 = t1.c4

                    and u1.c0 =  t1.c0 -- assume this is primary key

)

c4 = '1234'; <-- Filter ????

I had to do some good amount of work get this query working but it is very slow. The table has 600K rows currently. When I checked on SQL monitor (11.2) , it is showing that one of the hash joins are sort of creating huge amount of rows 400M..etc.

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