Creating multiple nodes and connect them in single Cypher query

31 views
Skip to first unread message

Krishna Shetty

unread,
Oct 28, 2014, 3:58:18 AM10/28/14
to ne...@googlegroups.com
I have a requirement where I need to create multiple nodes and connect them in a single(instead of running separate cypher quries) cypher query request. This is to improve the write performance.
I am following below method:
create (c:Person{guid:1}) with c create (m1:Book{id:1}) with c,m1 create (m2:Book{id:2}) with c,m1,m2 create (c)-[:READ]-> (m1) with c,m1,m2 create (c)-[:READ]-> (m2) return c,m1,m2;

Is this the right approach?

I have asked a question on SO at http://stackoverflow.com/questions/26595291/neo4j-write-performance-improvement , but haven't got an answer yet.

Thank you.

Michael Hunger

unread,
Oct 28, 2014, 4:59:28 AM10/28/14
to ne...@googlegroups.com
You don't need the with here
Not even multiple create clauses, commas are enough
Make sure to use parameters instead of literal values for properties

Von meinem iPhone gesendet
--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages