title: SQL(plus) performance with sequence
body: <p>I have to generate some million update from some table, to update themselves. I had just recently learned about <code>parallel(tablename,threads)</code> which really improved the performance in PLSQL developer when I had run something like this:</p>
  
  <pre><code>select /* + parallel(table1,100) parallel(table2,100) */
         'update table1 set id = 1 where ... and id = '||table1.id||' ...
  where ...
  </code></pre>
  
  <p>(I'm doing it like this, because it gives me the backup data in the update. And my BOSS told me to do it like this ;-))</p>
  
  <p>So it really worked fast when using a static number in the <code>set id = 1</code> part and in PLSQL Developer.</p>
  
  <p>But then I wrote it to a file, and inserted a <code>create sequence</code> before, and tried to use the sequence as follows:</p>
  
  <pre><code>create sequence myseq
   start with   4200000
   increment by 1
   maxvalue     11200000;
  
  
  select /* + parallel(table1,100) parallel(table2,100) */
         'update table1 set id = '||myseq.nextval||' where ... and id = '||table1.id||' ...
  where ...
  </code></pre>
  
  <p>But now it's terribly slow. And I don't know why. I just rewrote the <code>update</code> generator, to insert static data in there, and used <code>awk</code> to replace that with a sequence of numbers, but could someone explain what had caused this (and can I do something about it)?</p>
  
  <p>Thanks in advance!</p>