Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-24-2019 03:03 AM
Please help me understand how these two queries are different as one with where clause seems to be faster.
profile match (doc1:Document)-[*]->(doc2:Document)
where doc1.uid = "58ad88227faf733d28c8c4ee" and doc2.typeName = "Disease"
return doc2
and
profile match (doc1:Document {uid: "58ad88227faf733d28c8c4ee"})-[*]->(doc2:Document {typeName: "Disease"})
return doc2
Solved! Go to Solution.
07-24-2019 05:08 AM
These two queries should have the same query plan right?
They should also both have the same number of DB hits.
What might differ is the elapsed time for each. That would depend on whether you have warmed up the cache and also if the queries needed to be compiled. To truly measure the performance of these two queries that should be the same you can:
Use parameters, rather than constants in your queries where you define a parameter for $uid and $typeName. For example:
:params {uid: "58ad88227faf733d28c8c4ee" , typeName: "Disease"}
match (doc1:Document)-->(doc2:Document)
where doc1.uid = $uid and doc2.typeName = $typeName
return doc2
Make sure the page cache is sized to be the size of your graph.
Warm up the cache with a statements such as:
MATCH (n) RETURN max(id(n))
MATCH ()-[rel]->() RETURN max(id(rel))
Run both queries (without profile) to make sure they are in the query cache.
Finally run each query with profile.
Elaine
07-24-2019 05:08 AM
These two queries should have the same query plan right?
They should also both have the same number of DB hits.
What might differ is the elapsed time for each. That would depend on whether you have warmed up the cache and also if the queries needed to be compiled. To truly measure the performance of these two queries that should be the same you can:
Use parameters, rather than constants in your queries where you define a parameter for $uid and $typeName. For example:
:params {uid: "58ad88227faf733d28c8c4ee" , typeName: "Disease"}
match (doc1:Document)-->(doc2:Document)
where doc1.uid = $uid and doc2.typeName = $typeName
return doc2
Make sure the page cache is sized to be the size of your graph.
Warm up the cache with a statements such as:
MATCH (n) RETURN max(id(n))
MATCH ()-[rel]->() RETURN max(id(rel))
Run both queries (without profile) to make sure they are in the query cache.
Finally run each query with profile.
Elaine
07-24-2019 05:48 AM
Thank you so much for the suggestions.
All the sessions of the conference are now available online