Relationship to new or existing node?

65 Views Asked by At

I am using Neo4j for some weeks now and there is still a point I don't really get I guess. I have a data model with two nodes labeled as "match" and "player" nodes. In my application, players can play matches against each other. For example: John wins a match FIFA Football 17 against Doe. So I have a MatchNode with relationship winner to PlayerNode John and a relationship loser to PlayerNode Doe. So far so good. Next time John plays Rocket League against Laura and wins. Will the Rocket League MatchNode build a relationship to the existing John PlayerNode from the first FIFA example or should I create a new PlayerNode John for every match he takes part?

I hope you can understand my question.

Cheers

1

There are 1 best solutions below

0
On BEST ANSWER

If you do not have a use case that requires you to create duplicate nodes for John (and it would be very unusual if you did have such a use case), then you should re-use the same node to avoid wasting DB resources and query execution time.