Reputation: 894
I'm having troubles with the current data model and was wondering if anyone could suggest a better way to structure my data. My nodes labelled 'Person' have 5-10 properties each like: Name, Address, Nationality, Phone, Age... And there is no unique property I could use as an Index.
Since I don't want duplicates, every time I create a new person I use MERGE instead than CREATE. But the problem is that doing a MERGE where I'm matching 5-10 properties on a node slows down the queries enormously.
So would taking out the properties in each Person node as separate nodes labeled Address, Nationality, Phone, Age help the performance of my MERGE query? Any other possible solutions?
Thanks in advance!
Upvotes: 0
Views: 746
Reputation: 2128
How about generating a GUID/UUID that's unique for each person and using that as your ID for each Person? Then you could MERGE on that property quickly and use ON CREATE to set the other properties e.g.
MERGE (p:Person {id: 'abcd-efgh-...'})
ON CREATE SET p.name = "mark", p.address = "..."
Or if not then maybe a hash or combination of all those properties as your key e.g.
MERGE (p:Person {id: "name-address-nationality-phone"})
ON CREATE SET p.name = "...", p.address = "..."
Upvotes: 1