title: oracle merge performance
body: <pre><code>MERGE INTO table1 t1
  USING 
      (SELECT column1 
       FROM table2 join table3 on... 
       WHERE table2.column5 = 'xyz') t2
  ON (t1.column1 = t2.column1 AND t1.column2 =  somevalue 
  AND t1.column3 = someothervalue)
  WHEN not matched 
  THEN 
  INSERT ...
  </code></pre>
  
  <p>The "on" part will reject most of the rows, but does merge query all the rows that are inside "using" first? In that case that part will be running uselessly most of the times because 95% of the rows will not match <strong>t1.column2 =  somevalue 
                      AND t1.column3 = someothervalue</strong>. Or is Oracle smart enough to not do that? </p>