I have used the import tool to read in ~1 million nodes. Now it is time to set relationships. (Unfortunately, it looks like you have to have relationships predetermined explicitly in a csv if you want to use the import tool, so that is out of the question.)
First thing I did was to put an index on the nodes.
Next, I wrote this, which I'm wondering is my problem -- even with an index, this statement might cause too many cartesian products?:
USING PERIODIC COMMIT 500
LOAD CSV WITH HEADERS FROM
'file:///home/monica/...relationship.csv' AS line
MATCH (p1:Player {player_id: line.player1_id}), (p2:Player {player_id: line.player2_id})
MERGE (p1)-[:VERSUS]-(p2)
Apparently the USING PERIODIC COMMIT 500 didn't help, as I got my error,
Java heap space
Googling around, I learned that it might help to change my memory settings in the neo4j-wrapper.conf file, so I changed the settings all the way up to 4GB (I have an eight GB system):
wrapper.java.initmemory=4096
wrapper.java.maxmemory=4096
Still got the same error.
Now, I'm stuck. I can't think of any other strategies, besides:
1) rewrite the statement
2) use a system with more RAM?
3) find some other way to run this in batches?
Any advice would be awesome. Thanks to the neo4j SO community in advance.