Create new relation between customer and product for each purchase or

... increment relation 'no_of_purchases' property when customer purchase product again?

Which approach will be better from performance perspective?
I expect it will go much faster to create new relation than update relation property value. But probably it will take longer time to get answer 'show me customers' products where they have purchased at least X same product'.
We talk about dozens of thousands of customers and 20-40 thousands of products.
What would you recommend?

Regards,
G.

If you know the ids for both the customer and the product incrementing a property on the relationship shouldn't have any adverse effects on operation speed. I would think it would be preferable to put the property on the relationship and spare yourself the creation of multiple relationships and attempting to traverse them.

1 Like