1. Update your Neo4j version to something more recent.

2. This query was not well handled by the old planner, the new one in 2.2 GA 
should do much much better on that.

3. You can use something like this as a workaround meanwhile:

MATCH (me:User {username:'Kaylee83639'})-[:FRIENDS]-(people)
WITH me, COLLECT(people) as friends
MATCH (me)-[:FRIENDS]-()-[:FRIENDS]-(fof)
WHERE me <> fof 
with fof, count(*) as freq, friends limit 1000
where not (fof in friends)
return fof.username, freq order by freq desc limit 10



> Am 12.03.2015 um 11:16 schrieb ron zheng <ron.yongx...@gmail.com>:
> 
> there are 15M nodes and 150M relations in the db, i run the following cypher 
> and it takes more than 200 secondes to get the result. machine cpu&memory is 
> low. what should i do to improve? I'd appreciate some advise.
> 
> cypher:
> 
> START me=node:node_auto_index(userId='32887522')
> 
> MATCH 
> (me)-[:RELATIONSHIP_TYPE_FRIEND]-(people)-[:RELATIONSHIP_TYPE_FRIEND]-(fof)
> 
> RETURN fof,count(*) AS commonFriends
> 
> ORDER BY commonFriends DESC
> 
> LIMIT 100;
> 
> and get the excute plan:
> 
> ColumnFilter(symKeys=["fof", " 
> INTERNAL_AGGREGATEeaff758c-8eda-498a-9366-9965f62d16fc"], 
> returnItemNames=["fof", "commonFriends"], _rows=100, _db_hits=0)
> 
> ==> Top(orderBy=["SortItem(Cached( 
> INTERNAL_AGGREGATEeaff758c-8eda-498a-9366-9965f62d16fc of type 
> Long),false)"], limit="Literal", _rows=100, _db_hits=0)
> 
> ==> EagerAggregation(keys=["fof"], aggregates=["( 
> INTERNAL_AGGREGATEeaff758c-8eda-498a-9366-9965f62d16fc,CountStar)"], 
> _rows=3661, _db_hits=0)
> 
> ==> TraversalMatcher(trail="(me)-[ UNNAMED62:RELATIONSHIP_TYPE_FRIEND WHERE 
> true AND true]-(people)-[ UNNAMED99:RELATIONSHIP_TYPE_FRIEND WHERE true AND 
> true]-(fof)", _rows=15470, _db_hits=15547)
> 
> ==> ParameterPipe(_rows=1, _db_hits=0)
> 
> -- 
> 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 
> <mailto:neo4j+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to