I'm a developer with limited experience of DB architecture. I just started to rough up what my DB for rethinkdb should look like and I came up with something like this:
User
- Project IDs (including access level)
- ...
Project
- Or should this have User IDs (and access level)?
- Language IDs (1 to many)
- ...
Language
- Or should this have a Project ID instead?
- ...
Language Entry
- Language ID
- ....
It occurred to me that the IDs which join the data could go in a couple of different places:
- Should a User hold the Projects they belong to and other data like access level, or should a Project hold the Users?
- Should the Project hold Language IDs, or should a Language hold the Project ID?
What's best practice/more efficient?
My guess is that it's more efficient to do:
- User access site, we know the Project IDs so can grab them
- Project IDs know the Language IDs so can grab them
- Language knows the Language Entry IDs so can grab them
Especially where there could be a LOT of Language Entries across all projects, my assumption is that it would be slow to iterate through them all looking for matching Language IDs.