No, Neo4j actually uses an indexing system to find the "first" nodes.
create index on :Person(name); sets up that index so when you later run MATCH (p:Person)-[:ACTED_IN]->(m:Movie) WHERE p.anme = "Tom Cruise" RETURN m; it will use that index to find the node of Tom Cruise first. there is also an option for unique keys to use a constraint: create constraint on (p:Person) assert p.name is unique; On Sun, Jun 28, 2015 at 8:13 AM, Rammohan Vadlamani <[email protected]> wrote: > > Hello Everyone, > Having gone through the neo4j tutorial I find that > it is a great tool where you have complex join operations between nodes. > The graph model would significantly reduce the time. > > But I would like to know one thing. Neo4j stores all the data in nodes. > Now say for example I have a very huge movie database of more than 10 > million nodes, each node used to represent a different entity. If I wanted > to find all the movies that "Tom Cruise" acted in then in the worst case > Neo4j would have to iterate through all the 10 million nodes to find the > node "Tom Cruise". Would that not mean a performance hit. > > Regards, > Rammohan > > -- > 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. > -- 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.
