Hi !

i want to know how many relationship and node i have in my database.
My bruteforce way is *insanly* slow (at this speed... it will take
(many?) hours...)

Here is the code :

tx = neo.beginTx();
for (Node node : neo.getAllNodes()) {
        nodecounter++;
        for (Relationship relation : node.getRelationships(Direction.OUTGOING)) 
{
                relationcounter++;
        }
        if((nodecounter % 1000) == 0) { System.out.println(nodecounter + " :
" + relationcounter); }
}
tx.success(); tx.finish();
System.out.println("Number of nodes : " + nodecounter);
System.out.println("Number of relations : " + relationcounter);

Any better idea ?

-- 
Laurent "ker2x" Laborde
Sysadmin & DBA at http://www.over-blog.com/
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to