Reputation: 47
Hi I am trying to load edge files to neo4j of approximately 80000 records each. I am using:
USING PERIODIC COMMIT 500 LOAD CSV WITH HEADERS FROM
"file:///EdgesWriterSong_wrote.csv" AS csvLine
MATCH (writer:Writer { id: toInt(csvLine.WriterId),(songs:Songs { SongId: toInt(csvLine.SongId)
CREATE (writer)-[r:Wrote]->(songs)
It is taking way too much time to load. Is there a quicker way pls?
Upvotes: 0
Views: 48
Reputation: 67044
Your query has syntax errors, but I will assume your actual code looks like this:
USING PERIODIC COMMIT 500 LOAD CSV WITH HEADERS FROM "file:///EdgesWriterSong_wrote.csv" AS csvLine
MATCH (writer:Writer { id: toInt(csvLine.WriterId) }),
(songs:Songs { SongId: toInt(csvLine.SongId) })
CREATE (writer)-[r:Wrote]->(songs);
The most obvious reason for slowness for such a simple query would be that you have not yet created indexes for :Writer(id)
and Songs(SongId)
. Do that by running these 2 queries (one at a time):
CREATE INDEX ON :Writer(id);
CREATE INDEX ON :Songs(SongId);
Upvotes: 1