cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is it possible to speed up relationship queries?

lingvisa
Graph Fellow

 

MATCH (m:Sports)-[r:hasPlayer]-(n:Sports)
RETURN properties(n) as properties1, properties(m) as properties2 limit 100000
 
This takes quite a while to complete given around 50000 Sports node. I hope it can be finished under one 1 second, since it's not a huge graph. Basically, I want to return all relations between two node types, and potentially supplying a 'limit' parameter. 
 
What can I do to speed it up?
1 REPLY 1

Hi @lingvisa ! 

This query seems to be scanning all the nodes from the labels that you're using, possibly twice, hence the time that it takes. So, maybe if you share us a little bit more context of the use case then we can help you:

  • Which is the model? (CALL db.schema.visualization())
  • How do you want to use Neo4j for this uses case? Why did you choose it for this problem?
  • Could you share an EXPLAIN or PROFILE of the intended query?
  • Which is the java heap size configured in neo4j.conf?

Cheers!