SQL Language (MOSC)

MOSC Banner

update subquery speed

edited Nov 3, 2011 10:22AM in SQL Language (MOSC) 4 comments
Hi,The following update stmts do the same thing. Which one should be the fastest and which one is the slowest and why?

Version = 10.2.0.4

Thanks,
Sha
 
1.
UPDATE target_tab a SET target_col = (SELECT src_col FROM src_tab b WHERE a.key = b.key);

2.
UPDATE(
SELECT b.src_col,a.target_col
  FROM target_tab a inner join src_tab b ON a.key = b.key
) SET target_col = src_col;

3.
MERGE INTO target_tab a
 USING (SELECT src_col FROM src_tab) b
    ON (a.key = b.key)
 WHEN matched THEN
 UPDATE SET a.target_col = b.src_col;

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