慢neo4j密码查询

Gad*_*ady 6 neo4j cypher neography

我试图找出为什么我的密码查询运行如此缓慢(仅5000个节点2-5秒).该查询试图找到个人资料可以在他的网络内找到的所有工作(他的朋友或他的朋友的朋友在同一家公司工作的工作)

这是查询:

Start current_profile= node:node_auto_index(neoid_unique_id = "Profile:1")
 Match current_profile-[r:friendships*0..2]->friends-[:roles]->company-[:positions]->jobs
 return distinct company.fmj_id
Run Code Online (Sandbox Code Playgroud)

我试着修剪查询以查看我做错了什么,即使这个简单的查询也需要太长时间:

START root=node(0)
Match root-[:job_subref]->j-[:jobs]->jobss
return jobss
Run Code Online (Sandbox Code Playgroud)

我做错了吗?

我正在使用基于neography gem的neoid

小智 2

尝试这个查询怎么样

Start current_profile= node:node_auto_index(neoid_unique_id = "Profile:1")
Match current_profile-[r:friendships*0..2]->friends
WITH friends
friends-[:roles]->company-[:positions]->jobs
RETURN company.fmj_id
Run Code Online (Sandbox Code Playgroud)