How to write a more efficient import query in Neo4j using APOC

234 views Asked by At

I have a large DB and when I try to execute my query:

https://textuploader.com/1cduz

It takes more than 4 days to finish.

Can you help me to build a new one that may be using APOC?

1

There are 1 answers

9
Rajendra Kadam On

I think you are not using Constraints(or Indexes).

From your query, it looks like workId is a unique key. You should create a unique constraint on it for faster search in the MERGE clause.

CREATE CONSTRAINT unique_work_id
ON (n:Work)
ASSERT n.workId IS UNIQUE

You can also check a few other tips on faster data load in this answer.