Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
07-14-2020 03:11 PM
Hi,
My neo4j db has 3 million nodes and 32 million relationships, I'm running :
MATCH (p:Person{id:123})-[r*..2]-(m) WHERE NONE(x in r WHERE type(x) in ['Buyer','Seller','Owner']) RETURN p,r,m
when a node has many relationships it crashes (PROFILE crashes too), is there any way to improve the query??
07-18-2020 07:42 AM
Is the depth check on relationships necessary? Meaning are you only looking for that pattern that matches 2 deep? Or are you looking for nodes that don't have the relationship at all? If it's not necessary to go deep into those relationships it would speed up your query quite a bit. You might be able to do something like:
MATCH (p:Person {id: 123})
WHERE NOT (r in (p)-[r*..2]->(m))
the rest of your logic here
You're currently traversing a lot of relationships which I'm sure is hurting your performance.
07-20-2020 12:02 PM
Thanks for your reply. Yes, the depth check is necessary. I'm trying get all relationships expt Buyer,Seller,Owner up to the second depth level.
I think this part of exclusion is crashing :
All the sessions of the conference are now available online