Thanks! Michael, will try this out On Thursday, May 1, 2014 5:15:12 PM UTC+8, Michael Hunger wrote: > > 1. Use labels + indexes (or constraints) > > Without an label + existing index your first operation (merge) will have > to go over all nodes in the graph to find if there is already a duplicate > which it would then merge to > the second CREATE UNIQUE should be a MERGE too. > > 2. Use parameters for your literal input values, otherwise cypher has to > recompile the query every time and cannot reuse-the pre-compiled query > plans. > 3. you might want to move from Java-Rest-Binding to the JDBC driver, which > is much better for cypher interactions with the server. > > > > On Wed, Apr 30, 2014 at 9:25 AM, Gene Tan <[email protected]<javascript:> > > wrote: > >> Hello, >> >> I am new to neo4j >> currently already have a graph that contains at least 180000 nodes and >> 1400000 >> relationships , >> I am inserting data by batch of 500 queries, through the java rest >> binding library, and have observed that some queries had encountered read >> timeout, I was wondering if it is because of my query used for inserting >> data. Or is it related to configurations with neo4j.. >> Here is a sample query that I am using for inserting data >> >>> MERGE (firstNode {id:'1234'}) >>> ON CREATE SET firstNode.brand="Dove", firstNode.updated = >>> timestamp(),firstNode >>> :Soap >>> ON MATCH SET firstNode.updated=timestamp() >>> MERGE (secondNode{id:'2345'}) >>> ON CREATE SET secondNode.name="Dove Manufacturer", secondNode.updated >>> =timestamp >>> (), firstNode:Company >>> ON MATCH SET secondNode.updated=timestamp() >>> WITH firstNode, secondNode >>> //CHANGE MANUFACTURER if there is an existing manufacturer >>> OPTIONAL MATCH firstNode - [existing:`manufacturer`] - () >>> DELETE existing >>> CREATE UNIQUE p = (firstNode)-[r:`manufacturer`]-(secondNode) RETURN p; >>> >> >> Is there anyway to make this query run faster? >> >> Thanks! >> >> -- >> 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] <javascript:>. >> 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.
