title: PostgreSQL how to split a query between multiple CPU
body: <p>I have a store procedure <br></p>
  
  <pre><code>DO_STUFF(obj rowFromMyTable) 
  </code></pre>
  
  <p>This take obj and process some data and save the result in an independent table.
  So the order i process the objects isn't important.</p>
  
  <pre><code>DO_STUFF(objA); DO_STUFF(objB); &lt; == &gt;  DO_STUFF(objB); DO_STUFF(objA);
  </code></pre>
  
  <p>The thing is want create a store procedure to process all object, but this use only a single CPU.</p>
  
  <pre><code>for each obj in (SELECT obj from tblSOURCE)
  loop
      DO_STUFF(obj);
  end loop;
  </code></pre>
  
  <p>I want to split the process in multiple CPU so things finish faster.<br>
  The only thing i think of was using 2 pgAdmin window and run two different store procedure in each one.<br></p>
  
  <pre><code>--one window run using the filter
  (SELECT obj from tblSOURCE where id between 1 and 100000)
  
  --and the other use
  (SELECT obj from tblSOURCE where id between 100001 and 200000)
  </code></pre>
  
  <p>Any ideas of how should i do this in a single store procedure?</p>