Spider
Spider

Reputation: 915

Deleting even a single relationship hang forever in Neo4J

I am trying to delete a single relationship in a Neo4J database that contains over 200k ones, but it hangs forever. Here the request I am trying to execute:

MATCH p=()-[r:LINKED_TO]->() WITH r LIMIT 1 DELETE r

Is there an issue with the request, or any other reason why this is taking too much ? Is there another way to do it in a more optimal way ?

Upvotes: 0

Views: 129

Answers (1)

logisima
logisima

Reputation: 7458

If you add a label on one of the relationship's nodes, it will be much faster.

Without it, the database is doing a all node scan, and depending of size of your db, and where is the first node with a LINKED_TO, it can takes time ...

Upvotes: 1

Related Questions