With a reasonable heap size (4-8G) you can delete up to 1M records (nodes and 
rels in one run)

If you want to delete all I very much recommend to just to delete the 
data/graph.db directory.

if you have more data to delete out of even more data, you can do something 
like this:

// find the nodes you want to delete
MATCH (n:Foo) where n.foo = "bar" 
// take the first 10k nodes and their rels (if more than 100 rels / node on 
average lower this number)
WITH n LIMIT 10000
MATCH (n)-[r]-()
DELETE n,r
RETURN count(*);

run it until the statement returns 0 (zero).


> Am 03.07.2015 um 01:06 schrieb Yabo Gao <[email protected]>:
> 
> I tried this and it went ok:
> START n = node(*)
>       MATCH n-[r]-()
>       DELETE n, r
>         DELETE n
> Its really similar to yours.
> 
> On Thursday, May 17, 2012 at 2:58:12 PM UTC-7, Johnny Weng Luu wrote:
> First of all, thank you so much for introducing mutative Cypher. It totally 
> rocks!!! :D
> 
> I usually delete all nodes and relationships with two queries:
> 
> All nodes with relationships:
> 
>       START n = node(*)
>       MATCH n-[r]-()
>       DELETE n, r
> 
> All nodes without relationships:
> 
>       START n = node(*)
>       DELETE n
> 
> Is there a way to delete all nodes and relationships with just one query?
> 
> I thought this one would do it but it failed:
> 
>       START n = node(*)
>       MATCH n-[r?]-()
>       DELETE n, r
> 
> Johnny
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to