Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-15-2022 01:03 PM
Hi,
I am trying to delete all the relationships of a certain type from my database. At first it was working fine with the following code
CALL apoc.periodic.iterate(
'MATCH ()-[r:REL]->() RETURN id(r) AS id',
'MATCH ()-[r:REL]->() WHERE id(r)=id DELETE r',
{batchSize: 5000, parallel:true});
But now nothing seems to be working and when I do
MATCH ()-[r:REL]-() return count(r)
I always get roughly 200k
back.
If I try to do something like
MATCH ()-[r:REL}-() return id(r) limit 1
Or
MATCH p=()-[r:REL}-() return p limit 1
The query just hangs indefinitely until I terminate it. Anyway to troubleshoot this?
I am on 4.4.0 Enterprise
03-18-2022 08:36 AM
I don't know if this is your case but, as said here apoc.periodic.iterate - APOC Documentation :
For more complex operations like updating or removing relationships,
either do not use parallel: true
OR make sure that you batch the work in a way that each subgraph of data is updated in one operation,
such as by transferring the root objects.
If you attempt complex operations, also enable retrying failed operations, e.g. with retries:3.
If this doesn't work, is there anything useful in errorMessages
column of apoc.periodic.iterate
result and / or in neo4j.log
/ debug.log
files?
03-18-2022 11:32 AM
@giuseppe.villani I'm on Neo4j Aura so don't have access to neo4j.log
unfortunately.
I did manage to get it working by removing the direction on the query. Interesting adding a ->
over a -
slowed it down. Not sure if you have insight into this.
All the sessions of the conference are now available online