Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Join on vs intersect, for update query with Multiple tables??

Join on vs intersect, for update query with Multiple tables??

From: <qazmlp1209_at_rediffmail.com>
Date: 28 Jan 2007 22:19:33 -0800
Message-ID: <1170051573.770536.270960@l53g2000cwa.googlegroups.com>


For the given problem, we have arrived at 2 solutions:

Solution-1:
> > update tab2 t2_alias
> > set col_c_2 = null
> > where exists
> > (select col_a_1
> > from
> > (select col_a_1, col_b_2, col_C_2, count(col_a_1) over (partition by
> > col_a_1
> > order by col_a_1) as data_count
> > from tab1
> > join tab2 on (col_a_1 = col_a_2)
> > where col_b_1 = 'true'
> > )
> > where data_count = 1
> > and col_a_1 = t2_alias.col_a_2)

Solution-2:
> UPDATE tab2
> SET col_c_2 = null
> WHERE col_a_1 IN
> ( SELECT col_a_1 FROM tab1 WHERE col_b_1 = 'true'
> INTERSECT
> SELECT col_a_2 FROM tab2 GROUP BY col_a_1 HAVING count(1) = 1
> );

Can anybody comment on which one is more performant, considering the following?
> In my case, the Tab2 has almost 10 million rows and the Tab1 has 2-3
> million rows. In that case, do we have to use any further optimized
> techniques?
Received on Mon Jan 29 2007 - 00:19:33 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US