title: How to speed up the relationship creation with match...create
body: <p>I'm creating nodes and relationships programmatically using <strong>neo4j java driver</strong> based on reading the relationships specified in a <strong>csv file</strong>. </p>
  
  <p>The csv file contains about <strong>16 million rows</strong> and there will be about <strong>16*4 million relationships</strong> to create. </p>
  
  <p>I'm using the pattern <code>Match Match Create</code> for this purpose :</p>
  
  <pre><code>Match (a:label), (b:label) where a.prop='1234' and b.prop='4567' create (a)-[:LINKS]-&gt;(b)
  </code></pre>
  
  <p>I just started the program and functionally it ran well. I saw nodes and relationships being created properly in the neo4j DB. </p>
  
  <p>However, for the past four hours, only 100,000 rows from the csv have been processed and only 92037 relationships being created. </p>
  
  <p>According to this speed, it will take about one months to finish processing the csv and creating all the relationships. </p>
  
  <p>I noticed that I was sending the <code>Match...Create</code> one by one to the <strong>session.writeTransaction()</strong>. </p>
  
  <p>Is there any way to batch them up so as to speed up the creation time?</p>