1
votes

I have 24M nodes in the db and I want to delete 2M. Those 2M nodes are not linked to any other nodes. Here are the details:

neo4j-sh (?)$ match (n:Description) return count (n);
+-----------+
| count (n) |
+-----------+
| 2151316   |
+-----------+
1 row
3474 ms
neo4j-sh (?)$ match (n:Description) delete (n);      
+-------------------+
| No data returned. |
+-------------------+
Nodes deleted: 2151316
9096 ms
Error occurred in server thread; nested exception is: 
    java.lang.OutOfMemoryError: Java heap space

The system has 16GB of memory. In the file neo4j-wrapper.conf I have:

wrapper.java.initmemory=4096
wrapper.java.maxmemory=8192

In the file neo4j-server.properties I have:

neostore.nodestore.db.mapped_memory=512M
neostore.relationshipstore.db.mapped_memory=512M
neostore.propertystore.db.mapped_memory=512M
neostore.propertystore.db.strings.mapped_memory=512M
neostore.propertystore.db.arrays.mapped_memory=512M

How can I solve this since deleting the entire db is not an option at this level of the game?

1

1 Answers

4
votes

You could delete them in smaller batches.

match (n:Description) with n limit 100000 DELETE n;