I'm trying to delete 1 million nodes in cyphper at one query using web admin(i.e localhost:7474/browser).
These nodes is labeled as User. I ran following query, then returned Unknown error after waiting about 1minutes.
match (u:User) delete u
This query returned Unknown error every time. and I confirm my PC resources didn't lack.
I'm using Neo4j version 2.0.0 RC1 community edition. and Neo4j Hosted on local.
Is My trying way for deletion nodes wrong?
Thanks
You should do write operations with a reasonable transaction size of ~10-50k atomic operations. Therefore you can use limit
and run the statement until all users are gone:
match (u:User) with u limit 1000 delete u
With Neo4j 3.x and forward you can run large delete transactions using APOC too:
call apoc.periodic.iterate("MATCH (u:User) return u", "DETACH DELETE u", {batchSize:1000})
yield batches, total return batches, total
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With