I am tempted to say that you can test both by benchmarking them. I
assume that you need this to be fast since many users use it, so try
both ways and see what it is better. Have in mind that the underlying
engine is important when designing something that gets heavy use. I get
the feeling
mysql.com says:
Foreign key enforcement offers several benefits to database developers:
* Assuming proper design of the relationships, foreign key
constraints make it more difficult for a programmer to introduce an
inconsistency into the database.
* Centralized checking of
Hey Guys,
I have been developing for a while and never found the best solution yet.
The question is lets say a game has 10 collectibles you can earn, to keep
track of the number of collectibles each user has, do you have one field in
the users table with all the numbers separated via a
Whenever you can say:
X has zero or more Y and Y has zero or more X you're talking about
a Many to Many relationship between X and Y, and you need a link
table with foreign key constraints.
Example:
Table X:
id name
1 A
2 B
3 C
Table Y:
id name
1 K
2 L
3 M
Linktable:
X_id Y_id
1