Faster way to mark and filter a big amount of nodes/relationships

Hi everyone,

I am having around 350M nodes and 500M relationships from which I want to do the following operation:

MATCH ()-[r]->()
WHERE r.toBeDeleted = 1 AND r.deleted = 0
SET r.deleted = r.toBeDeleted

Currently, I do this with apoc.periodic.iterate for batching purposes but it usually takes 15mins to do this operation only. Is there any other apoc procedure that I could set properties while doing the where condition so that I could speed up this process as well?

All the best,

I believe version 5 now has indexes on relationship properties. This may help since you are searching strictly on those.

Sure and I am using those but still too slow. Maybe though that there would be a apoc procedure to get a faster result there.

Have you looked at the query plan to verify it is using at least one index.