Hello,

Hi. I'm having problems deleting nodes and relationships from a server-side 
plugin. 

I have a following code that is supposed to accomplish this: 


   1. public class Purger {
   2.    private static final int BATCH_SIZE = 1000;
   3. 
   4.     ...
   5. 
   6.     public static void purgeDictionary(GraphDatabaseService graphDb, 
   int dictionary) {
   7.        Transaction tx = graphDb.beginTx();
   8.        int count = 0;
   9.        try {
   10.            for (String label : new String[]{"station", "arrival", 
   "departure", "change", "dictionary", "estimate-station"}) {
   11.                ResourceIterable<Node> nodes = graphDb.
   findNodesByLabelAndProperty(DynamicLabel.label(label), "dictionary-id", 
   dictionary);
   12. 
   13.                 for (Node node : nodes) {
   14.                    for (Relationship rel : node.getRelationships()) {
   15.                        rel.delete();
   16.                    }
   17. 
   18.                     node.delete();
   19. 
   20.                     if (++count % BATCH_SIZE == 0) {
   21.                        tx.success();
   22.                        tx.close();
   23.                        tx = graphDb.beginTx();
   24.                    }
   25.                }
   26. 
   27.             }
   28.            tx.success();
   29.        } finally {
   30.            tx.close();
   31.        }
   32.    }
   33. 
   34.     ...
   35. }
   



The problem is, the operation quickly fills up the heap, no matter if it's 
2GB or 8GB. The graph has about 1.7M nodes. What am I doing wrong here? 

I'm currently running neo4j 2.1.7 under JDK8 under 64bit Linux Debian 
derivative.

Regards,
Adrian

-- 
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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to