It sounds as if you are looping through all of them? Have they all the same relationshiptype and direction?
Otherwise perhaps use node.getRelationships(type, direction) Perhaps you can also use a traverser for accessing the relationship? Cheers Michael Am 01.02.2011 um 12:37 schrieb Mattias Persson: > 2011/2/1 Pablo Pareja <ppar...@era7.com> > >> Hi all, >> >> I'm working on a project with millions of nodes and relationships and I'm >> using Neo4j for it. >> I'm doing some tests and I'm surprised of how slow it gets when it comes to >> getting specific relationships >> from one node... >> >> How's it actually implemented? >> >> The node I want to get the relationships from is indexed so getting there >> is >> almost instantaneous, however >> looping over its outgoing relationships seems to be really slow. >> In the last test I just did it took about 10 minutes for retrieving around >> 45.000 outgoing relationships. >> > > What kind of heap settings and memory mapping configuration are you using? > This sounds like disk swapping IMHO. 45000 relationships are quite few and > should take well below a second to get. But if you just want to get a > specific relationship (based on a property value or other node or something > similar) then indexing would be a faster solution. Maybe something like > this: > > RelationshipIndex index = graphDb.index().forRelationships( > "my-relationships" ); > ... > Relationship myRelationship = myNode.createRelationship( myOtherNode, > myRelationshipType ); > index.add( myRelationship, "myKey", "myValue" ); > ... > Relationship relForMyKey = index.get( "myKey", "myValue" ).getSingle(); > for ( Relationships relBetweenMyNodes : index.get( null, null, myNode, > myOtherNode ) ) { > System.out.println( "Relationship " + relBetweenMyNodes + " found" ); > } > > Does that help you? > > >> I've also been checking the wiki site for the Index Framework and there's >> only one small paragraph talking about >> indexing relationships but not about how to create them >> >> RelationshipIndex friendships = graphDb.index().forRelationships( >> "friendships" ); >> // "type" isn't a reserved key and isn't indexed automatically >> Relationship relationship = friendships.get( "type", "knows", morpheus, >> trinity ).getSingle(); >> > > I'll try to update the wiki page with a little more/better information! > >> >> >> so do you have any idea of the proper way for indexing relationships? >> Thanks in advance, >> _______________________________________________ >> Neo4j mailing list >> User@lists.neo4j.org >> https://lists.neo4j.org/mailman/listinfo/user >> > > > > -- > Mattias Persson, [matt...@neotechnology.com] > Hacker, Neo Technology > www.neotechnology.com > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user