Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 354
Gady Avatar asked Mar 05 '13 16:03

Gady


People also ask

What can you do to improve the performance of Neo4j?

The size of the available heap memory is an important aspect for the performance of Neo4j. Generally speaking, it is beneficial to configure a large enough heap space to sustain concurrent operations. For many setups, a heap size between 8G and 16G is large enough to run Neo4j reliably.

What are the weaknesses of Neo4j?

Neo4j has some upper bound limit for the graph size and can support tens of billions of nodes, properties, and relationships in a single graph. No security is provided at the data level and there is no data encryption. Security auditing is not available in Neo4j.

Is Neo4j faster than MySQL?

Execution Time is in seconds, for 1,000 users. For the simple friends of friends query, Neo4j is 60% faster than MySQL. For friends of friends of friends, Neo is 180 times faster. And for the depth four query, Neo4j is 1,135 times faster.

Is Neo4j good for big data?

Tom's IT Pro in looking at 'Small to Big Data Solutions' notes that graph databases such as Neo4j would be better than Hadoop for some big data problems, particularly those described with networks and its relationships between objects.


1 Answers

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
like image 54
Mohamed E. ManSour Avatar answered Sep 30 '22 11:09

Mohamed E. ManSour