Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-24-2019 05:52 AM
04-24-2019 06:55 AM
You can model this in more than one way and the model you chose will depend on the queries.
You definitely do NOT want to create the same relationship between two nodes unless they differ by a property on the relationship. Using the specific relationship will most likely perform better for you, but specializing the CourseInstance may also perform well. You need to try the model that will give you the best performance for the queries.
Elaine
04-24-2019 07:04 AM
Thank your for your efficient reply ! I'm having a try, I will reply you again if I encounter other problems.Thanks again.
01-01-2022 04:37 PM
@elaine.rosenberg wanted to reopen this to discuss more on:
You definitely do NOT want to create the same relationship between two nodes unless they differ by a property on the relationship. Using the specific relationship will most likely perform better for you, but specializing the CourseInstance may also perform well.
Can you share why this is the case?
An example where this might apply is: User's photos. A user can have thousands of photos but only 1 current profile picture. Based on that, there could be two relationships:
(:User) - [:HAS_PHOTO] -> (:Photo)
(:User) - [:WITH_PROFILE_PHOTO] -> (:Photo)
You can also model a boolean property: "profile" but this will exist on every single relationship but true only for one and false for every other relationship. Even if this is indexed, this would perhaps be slower for a query like:
match (u: User) - [:HAS_PHOTO {profile: true}] -> [p: Photo]
return u, p
vs
match (u: User) - [:WITH_PROFILE_PHOTO] -> [p: Photo]
return u, p
Is the above (^) correct?
All the sessions of the conference are now available online