0

I am trying to load a graph of .3GB to neo4j using Neo4j Desktop (3.4.0) browser. I have set heap to 4 GB and page cache to 16 GB. However in between the browser looses connection and I am unable to load the graph. I am using the following command to load the graph:

LOAD CSV WITH HEADERS FROM "file:\\graphUnioned.csv" AS csvLine 
MERGE (s:Node {value:csvLine.s}) 
MERGE (o:Node {value:csvLine.o}) 
MERGE (s)-[:REL]->(o) 
RETURN *;

Is there some way by which I may accelerate the loading of graph

I am running neo4j on windows server

Jannat Arora
  • 2,759
  • 8
  • 44
  • 70

1 Answers1

0

I think the issue is not with loading the graph but with what you are returning.

You are returning the whole graph, and the browser will try to plot/visualize this, plotting these many objects on the browser may make it unresponsive.

Assuming the issue is with data load I would suggest following steps:

  1. Add an index on the keys on Node (here 'value'): Run this before running the second query.

CREATE CONSTRAINT ON (n:Node) ASSERT n.value IS UNIQUE

  1. Remove RETURN clause.
  2. Use periodic commit.
USING PERIODIC COMMIT  
LOAD CSV WITH HEADERS FROM "file:\\graphUnioned.csv" AS csvLine  
MERGE (s:Node {value:csvLine.s})
MERGE (o:Node {value:csvLine.o})  
MERGE (s)-[:REL]->(o);
  1. (OPTIONAL) Use only one merge in each query (Separate the query to one merge per query).
Rajendra Kadam
  • 4,004
  • 1
  • 10
  • 24