Gady
Gady

Reputation: 1514

slow neo4j cypher query

I'm trying to find out why my cypher query is running so slow (2-5 seconds for only 5000 nodes). The query is trying to find all the jobs the a profile can reach inside his network (a job the his friends or his friends of friends work in the same company)

This is the query :

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

I tried trimming down the query to see what I'm doing wrong and even this simple query takes too long:

START root=node(0)
Match root-[:job_subref]->j-[:jobs]->jobss
return jobss

Am I doing anything wrong?

I'm using neoid that is based on neography gem

Upvotes: 6

Views: 561

Answers (1)

Mohamed Ismail Mansour
Mohamed Ismail Mansour

Reputation: 1053

What about trying this query

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

Upvotes: 2

Related Questions