Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
06-29-2020 09:47 PM
What would be the best way to delete 1000+ or 100000+ selected nodes? Should I use UNWIND
and MATCH
to get a list of the nodes I want to delete then detach delete them.
UNWIND $data as delete
MATCH (c:Car)
WHERE c.model = delete.model
DETACH DELETE
This is very slow. Is there a better way?
Solved! Go to Solution.
06-30-2020 01:14 AM
Hello @tarendran.vivekanand
You can pass for example ids you want to delete in the data
, but if you want to keep your original request, you can still use apoc.periodic.iterate()
CALL apoc.periodic.iterate('MATCH (c:Car) WHERE c.model IN data RETURN c', 'DETACH DELETE c', {batchSize:1000, params:{data:$data}})
Regards,
Cobra
06-30-2020 01:14 AM
Hello @tarendran.vivekanand
You can pass for example ids you want to delete in the data
, but if you want to keep your original request, you can still use apoc.periodic.iterate()
CALL apoc.periodic.iterate('MATCH (c:Car) WHERE c.model IN data RETURN c', 'DETACH DELETE c', {batchSize:1000, params:{data:$data}})
Regards,
Cobra
06-30-2020 02:11 AM
Hello @Cobra
Thanks for the advice but how do you determine the batchSize number of 1000. Is this arbitrary or is there some formula to this?
06-30-2020 02:13 AM
It depends of the power of your computer , by default I use 1000, but you can try other values between 100 and 10 000
All the sessions of the conference are now available online