Oh sorry didn't notice that. I suggest to use MERGE instead of create unique as it takes degrees of nodes into consideration at runtime. (create unique is deprecated too).
So it would always check from the side with the fewer relationships. Michael > Am 27.05.2017 um 21:12 schrieb unrealadmin23 via Neo4j > <[email protected]>: > > Yes, but in at my example, the performance dramatically changes with the > direction of the relationship. > This occurs when both Entities exist or not. > > Do you know why I am seeing this behavior ? > > > On Saturday, 27 May 2017 08:51:34 UTC+1, Michael Hunger wrote: > I presume you have a constraint on :Entity(name) > > Merge does match-or-create > > So it tries to find first and otherwise create > > Von meinem iPhone gesendet > > Am 26.05.2017 um 12:16 schrieb unrealadmin23 via Neo4j > <[email protected]>: > >> John, Michael, >> >> Thank you for your suggestions. >> >> Interestingly I found my problem. Consider these 2 examples: >> >> neo4j> MERGE (node_c:Entity { name:'spumante cricova' }) MERGE >> (node_a:Entity { name:'romainian' }) WITH node_a, node_c CREATE UNIQUE >> (node_a)-[:language]->(node_c); >> 0 rows available after 2160 ms, consumed after another 0 ms >> >> neo4j> MERGE (node_c:Entity { name:'spumante cricova' }) MERGE >> (node_a:Entity { name:'romainian' }) WITH node_a, node_c CREATE UNIQUE >> (node_a)<-[:language]-(node_c); >> 0 rows available after 28 ms, consumed after another 0 ms >> >> Both entries may either need to be created or may already exist - it doesn't >> really matter. Either way I get consistent timings. >> >> Why is one much faster than the other ? >> >> Wayne >> >> On Friday, 26 May 2017 00:44:43 UTC+1, John Singer wrote: >> Wayne - I have a python program that will automatically generate cypher >> merges reading data from CSV files. I think I can beat your ingest rate >> below. If you're interested contact me at www.singerlinks.com (see the >> contact page) >> >> On Wednesday, May 24, 2017 at 6:54:18 AM UTC-5, [email protected] >> wrote: >> Hi Michael, >> >> Some of my work flows create very large amounts of cypher merge and create >> unique operations - potentially millions of lines. >> I break the master file into 50 smaller files, and cat these concurrently >> to cypher-shell. Actually its not quite that easy as a create >> smaller buckets before cat'ing them into cypher-shell due to limitations of >> the shell's buffering. >> I have good reason for using this approach, as the task is additive with >> periodic updates and many cypher lines are created 'on the fly' due to data >> dependencies. >> >> I am able to achieve an ingest rate of about about 500 lines of cypher per >> sec using this approach - but its is still not as fast as I would like. >> Are there any tweaks that might improve this approach ? >> >> Thanks, Wayne >> >> -- >> 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 [email protected]. >> For more options, visit https://groups.google.com/d/optout. > > -- > 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 [email protected]. > For more options, visit https://groups.google.com/d/optout. -- 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
