Kamelio
Kamelio

Reputation: 13

Cypher Query Complexity

How do I find out the complexity of Cypher queries?

This is my query:

MATCH (G1:FirstGraph) 
MATCH (G2:SecondGraph {IdRule:G1.IdRule}) 
WHERE G2.VRule<>G1.VRule  
MATCH (R:Rule{IdRule:G1.IdRule}) 
WITH G1,G2, count(R) as NbrOfVers
MATCH (T:ResultNode)
WITH T,sum(1-(tofloat(ABS(G2.VRule-G1.VRule))/NbrOfVers)) AS sum
SET T.SubCorrel = sum

Upvotes: 0

Views: 308

Answers (1)

cybersam
cybersam

Reputation: 67009

One way of determining the "cost" of a Cypher query is to precede your query using the PROFILE keyword. The profile output gives you the steps that the DB took to execute your query, and it will also tell you how many DB hits it took.

In general, you want to try to minimize the number of DB hits, as they are relatively expensive.

It would be nice if PROFILE (and EXPLAIN) could output the computational complexity of a query in big O notation, but that is not currently done.

Upvotes: 3

Related Questions