I'm pretty new to neo4j, and I'm working on optimizing my queries. For my 
example, let's say we have a lot of 'Post' nodes that can grow in an 
unbounded fashion. I'm using a linked-list to be able to scan back through 
recent posts without consulting every node. This works, but my question has 
to do with a minor semantic change that means the difference between 
consulting LIMIT nodes, or ALL nodes. First, the bad one; this query 
consults all Post nodes:

MATCH (r:Reference {id: 
"latest"})-->(:Post)-[:PREVIOUS*0..]->(p)-[:MEMBER_OF]->(c:Category)
RETURN p, COLLECT(c.uuid) AS c LIMIT 50

However, this next query only consults only the last 50, as I'd like. Could 
someone explain why putting the LIMIT on the WITH makes all the difference?

PROFILE MATCH (r:Reference {id: 
"latest"})-->(:Post)-[:PREVIOUS*0..]->(p)-[:MEMBER_OF]->(c:Category)
WITH p, c LIMIT 50
RETURN p, COLLECT(c.uuid) AS c

Thanks in advance for any insight!




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