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.

Make this query faster

villadsclaes2
Node Link

I am trying to make a search field, where i want the searchresults while typing. Therefore it needs to be VERY fast (at least somewhat as fast as typing, which is under .3 seconds pr. character)

 

 

MATCH (n)<-[:Mark]-(m) WHERE  m.name CONTAINS "Villads" WITH n AS soegeresultat, m AS relevant  RETURN relevant LIMIT 1 

 

1 ACCEPTED SOLUTION

@villadsclaes2 

Your queries use no labels.  i.e. match (m) simply says find me a node.   if your graph has 100 million nodes then match (n) is going to traverse each of the 100 million nodes.   However if your nodes have labels and lets say your graph of 100 million total nodes has 50k :Person nodes and your query is such that the search text is in a node with label :Person then a match (n:Person) would only scan 50k nodes, rather than all nodes in the graph.

also from a performance analysis perspective if you preface any cypher query with `EXPLAIN`  you will be able to see the path the query takes to satisfy the query.

View solution in original post

4 REPLIES 4

@villadsclaes2 

do u have a specific query concern?

 

That was a quick reply. I dont know how to edit a post, so I wrote it in the comments: 

villadsclaes2
Node Link

how to delete this comment?

@villadsclaes2 

Your queries use no labels.  i.e. match (m) simply says find me a node.   if your graph has 100 million nodes then match (n) is going to traverse each of the 100 million nodes.   However if your nodes have labels and lets say your graph of 100 million total nodes has 50k :Person nodes and your query is such that the search text is in a node with label :Person then a match (n:Person) would only scan 50k nodes, rather than all nodes in the graph.

also from a performance analysis perspective if you preface any cypher query with `EXPLAIN`  you will be able to see the path the query takes to satisfy the query.