Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
01-07-2020 03:24 AM
We are using the follow Cypher query:
MATCH (n:Entity)-[r]->(m) WHERE n.cid IN $cids RETURN labels(n), n, type(r), m"
Entity.cid
Are there any other query optimisations we can try to speed up this query?
Solved! Go to Solution.
01-07-2020 05:03 AM
If you've already got the list of cids, then you can simply call the matches:
UNWIND $cids AS cid
MATCH(n:Entity {id: cid})-[r]->(m)
return labels(n), type(r), m
should be quite a bit faster.
01-07-2020 05:03 AM
If you've already got the list of cids, then you can simply call the matches:
UNWIND $cids AS cid
MATCH(n:Entity {id: cid})-[r]->(m)
return labels(n), type(r), m
should be quite a bit faster.
01-07-2020 05:56 AM
Awesome! For some reason I didn't think UNWIND
would improve performance much for this instance, but it scales much better like this. For 500 cids in the list it is almost 10x faster to the initial query.
Thanks a lot!
EDIT: Silly me forgot to change Muddy's query and replace {id: cid}
with the correct {cid: cid}
so the query is still a bit faster but more like 1.5x instead of 10x - because it didn't fetch anything when it had the typo.
01-07-2020 06:09 AM
Yep, calling the exact node is always faster. Glad I could help.
All the sessions of the conference are now available online