Re: [Neo4j] Traversals versus Indexing

2011-06-12 Thread espeed
It depends on the traversal you are running.

--
View this message in context: 
http://neo4j-user-list.438527.n3.nabble.com/Neo4j-Traversals-versus-Indexing-tp3057515p3057538.html
Sent from the Neo4J User List mailing list archive at Nabble.com.
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Traversals versus Indexing

2011-06-13 Thread Craig Taverner
Think of your domain model graph as a kind of index. Traversing that should
generally be faster than a generic index like lucene. Of course some things
do not graph well, and you should use lucene for those. But if you can find
something with a graph traversal, that is likely the way to go.

Also you should think of structuring the graph to suit the queries you plan
to perform. Then you will optimize the traversals.
On Jun 13, 2011 11:33 AM, "espeed"  wrote:
> It depends on the traversal you are running.
>
> --
> View this message in context:
http://neo4j-user-list.438527.n3.nabble.com/Neo4j-Traversals-versus-Indexing-tp3057515p3057538.html
> Sent from the Neo4J User List mailing list archive at Nabble.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


Re: [Neo4j] Traversals versus Indexing

2011-06-16 Thread Mattias Persson
I don't know your use case at all, but one of the benefits you get with
traversing compared to index lookups is that one hop from a node to another
is instantaneous ( > 1 million hops / second on a fully cached graph),
whereas index lookups are several order of magnitudes slower than that. But
index lookups are good for when you f.ex. have thousands/millions of names
and you'd like to get the node with a certain name. Then that would be your
starting point for doing a traversal to find other information "local" to
that node, or in its vicinity.

2011/6/13 Aman 

> What is faster - Traversals or Indexing? I mean if one has a database model
> that can offer a choice between the two, what should one choose?
> Also, what about when the scalability factor comes in?
> ___
> 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


Re: [Neo4j] Traversals versus Indexing

2011-06-16 Thread Aseem Kishore
Are lookups by ID also so much slower than traversals?

Aseem

On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
wrote:

> I don't know your use case at all, but one of the benefits you get with
> traversing compared to index lookups is that one hop from a node to another
> is instantaneous ( > 1 million hops / second on a fully cached graph),
> whereas index lookups are several order of magnitudes slower than that. But
> index lookups are good for when you f.ex. have thousands/millions of names
> and you'd like to get the node with a certain name. Then that would be your
> starting point for doing a traversal to find other information "local" to
> that node, or in its vicinity.
>
> 2011/6/13 Aman 
>
> > What is faster - Traversals or Indexing? I mean if one has a database
> model
> > that can offer a choice between the two, what should one choose?
> > Also, what about when the scalability factor comes in?
> > ___
> > 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


Re: [Neo4j] Traversals versus Indexing

2011-06-16 Thread Mattias Persson
Are you thinking of GraphDatabaseService#getNodeById / #getRelationshipById
? Or index lookups?

2011/6/16 Aseem Kishore 

> Are lookups by ID also so much slower than traversals?
>
> Aseem
>
> On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> wrote:
>
> > I don't know your use case at all, but one of the benefits you get with
> > traversing compared to index lookups is that one hop from a node to
> another
> > is instantaneous ( > 1 million hops / second on a fully cached graph),
> > whereas index lookups are several order of magnitudes slower than that.
> But
> > index lookups are good for when you f.ex. have thousands/millions of
> names
> > and you'd like to get the node with a certain name. Then that would be
> your
> > starting point for doing a traversal to find other information "local" to
> > that node, or in its vicinity.
> >
> > 2011/6/13 Aman 
> >
> > > What is faster - Traversals or Indexing? I mean if one has a database
> > model
> > > that can offer a choice between the two, what should one choose?
> > > Also, what about when the scalability factor comes in?
> > > ___
> > > 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
>



-- 
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


Re: [Neo4j] Traversals versus Indexing

2011-06-16 Thread Aseem Kishore
Indeed getNodeById().

Aseem

On Thu, Jun 16, 2011 at 10:11 AM, Mattias Persson  wrote:

> Are you thinking of GraphDatabaseService#getNodeById / #getRelationshipById
> ? Or index lookups?
>
> 2011/6/16 Aseem Kishore 
>
> > Are lookups by ID also so much slower than traversals?
> >
> > Aseem
> >
> > On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> > wrote:
> >
> > > I don't know your use case at all, but one of the benefits you get with
> > > traversing compared to index lookups is that one hop from a node to
> > another
> > > is instantaneous ( > 1 million hops / second on a fully cached graph),
> > > whereas index lookups are several order of magnitudes slower than that.
> > But
> > > index lookups are good for when you f.ex. have thousands/millions of
> > names
> > > and you'd like to get the node with a certain name. Then that would be
> > your
> > > starting point for doing a traversal to find other information "local"
> to
> > > that node, or in its vicinity.
> > >
> > > 2011/6/13 Aman 
> > >
> > > > What is faster - Traversals or Indexing? I mean if one has a database
> > > model
> > > > that can offer a choice between the two, what should one choose?
> > > > Also, what about when the scalability factor comes in?
> > > > ___
> > > > 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
> >
>
>
>
> --
> 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


Re: [Neo4j] Traversals versus Indexing

2011-06-17 Thread Mattias Persson
getNodeById is fast/immediate

2011/6/16 Aseem Kishore 

> Indeed getNodeById().
>
> Aseem
>
> On Thu, Jun 16, 2011 at 10:11 AM, Mattias Persson <
> matt...@neotechnology.com
> > wrote:
>
> > Are you thinking of GraphDatabaseService#getNodeById /
> #getRelationshipById
> > ? Or index lookups?
> >
> > 2011/6/16 Aseem Kishore 
> >
> > > Are lookups by ID also so much slower than traversals?
> > >
> > > Aseem
> > >
> > > On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> > > wrote:
> > >
> > > > I don't know your use case at all, but one of the benefits you get
> with
> > > > traversing compared to index lookups is that one hop from a node to
> > > another
> > > > is instantaneous ( > 1 million hops / second on a fully cached
> graph),
> > > > whereas index lookups are several order of magnitudes slower than
> that.
> > > But
> > > > index lookups are good for when you f.ex. have thousands/millions of
> > > names
> > > > and you'd like to get the node with a certain name. Then that would
> be
> > > your
> > > > starting point for doing a traversal to find other information
> "local"
> > to
> > > > that node, or in its vicinity.
> > > >
> > > > 2011/6/13 Aman 
> > > >
> > > > > What is faster - Traversals or Indexing? I mean if one has a
> database
> > > > model
> > > > > that can offer a choice between the two, what should one choose?
> > > > > Also, what about when the scalability factor comes in?
> > > > > ___
> > > > > 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
> > >
> >
> >
> >
> > --
> > 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
>



-- 
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


Re: [Neo4j] Traversals versus Indexing

2011-06-17 Thread Aseem Kishore
Cool, thanks!

On Fri, Jun 17, 2011 at 5:01 AM, Mattias Persson
wrote:

> getNodeById is fast/immediate
>
> 2011/6/16 Aseem Kishore 
>
> > Indeed getNodeById().
> >
> > Aseem
> >
> > On Thu, Jun 16, 2011 at 10:11 AM, Mattias Persson <
> > matt...@neotechnology.com
> > > wrote:
> >
> > > Are you thinking of GraphDatabaseService#getNodeById /
> > #getRelationshipById
> > > ? Or index lookups?
> > >
> > > 2011/6/16 Aseem Kishore 
> > >
> > > > Are lookups by ID also so much slower than traversals?
> > > >
> > > > Aseem
> > > >
> > > > On Thu, Jun 16, 2011 at 3:45 AM, Mattias Persson
> > > > wrote:
> > > >
> > > > > I don't know your use case at all, but one of the benefits you get
> > with
> > > > > traversing compared to index lookups is that one hop from a node to
> > > > another
> > > > > is instantaneous ( > 1 million hops / second on a fully cached
> > graph),
> > > > > whereas index lookups are several order of magnitudes slower than
> > that.
> > > > But
> > > > > index lookups are good for when you f.ex. have thousands/millions
> of
> > > > names
> > > > > and you'd like to get the node with a certain name. Then that would
> > be
> > > > your
> > > > > starting point for doing a traversal to find other information
> > "local"
> > > to
> > > > > that node, or in its vicinity.
> > > > >
> > > > > 2011/6/13 Aman 
> > > > >
> > > > > > What is faster - Traversals or Indexing? I mean if one has a
> > database
> > > > > model
> > > > > > that can offer a choice between the two, what should one choose?
> > > > > > Also, what about when the scalability factor comes in?
> > > > > > ___
> > > > > > 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
> > > >
> > >
> > >
> > >
> > > --
> > > 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
> >
>
>
>
> --
> 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


Re: [Neo4j] Traversals versus Indexing

2011-06-20 Thread Massimo Lusetti
On Fri, Jun 17, 2011 at 2:01 PM, Mattias Persson
 wrote:

> getNodeById is fast/immediate

But the IDs could be recycled... isn't it?

Cheers
-- 
Massimo
http://meridio.blogspot.com
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Traversals versus Indexing

2011-06-20 Thread Jim Webber
Hi Massimo,

Yes, those IDs can be recycled. In theory you don't know when they'll be 
recycled either (in practice they may be stable between reboots in the current 
stack, but who knows what future behaviour will be).

Jim



On 20 Jun 2011, at 23:11, Massimo Lusetti wrote:

> On Fri, Jun 17, 2011 at 2:01 PM, Mattias Persson
>  wrote:
> 
>> getNodeById is fast/immediate
> 
> But the IDs could be recycled... isn't it?
> 
> Cheers
> -- 
> Massimo
> http://meridio.blogspot.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


Re: [Neo4j] Traversals versus Indexing

2011-06-21 Thread Mattias Persson
2011/6/20 Jim Webber 

> Hi Massimo,
>
> Yes, those IDs can be recycled. In theory you don't know when they'll be
> recycled either (in practice they may be stable between reboots in the
> current stack, but who knows what future behaviour will be).
>
> And hence it's a bad practice to store node/relationship ids as properties.
Try to solve your problems in another way if that's what you had in mind.


> Jim
>
>
>
> On 20 Jun 2011, at 23:11, Massimo Lusetti wrote:
>
> > On Fri, Jun 17, 2011 at 2:01 PM, Mattias Persson
> >  wrote:
> >
> >> getNodeById is fast/immediate
> >
> > But the IDs could be recycled... isn't it?
> >
> > Cheers
> > --
> > Massimo
> > http://meridio.blogspot.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
>



-- 
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