Reputation: 15158
I have a huge database. In this Database I have a User-Table.
In this User-table I have all information I can get about an user - adress, username, weight, haircolor and so much more (50-80 coloums I guess).
Now I will have User-settings.
Of course, 1 user can only have 1 setting, so its a 1:1-connection and in the rules of normalitation that I learned years before, the settings should go as a coloum in the user-table.
But logicaly its a big difference between user-information like an adress I will display for user / admins and settings for the website behauvior for an user.
What should I do? Own table for UserSettings and break the rules of normalitation for big logic difference OR put the settings as coloums in the User-Table and do not break the rules of normalitation for big logic???
Upvotes: 0
Views: 96
Reputation: 159
It's ok to break the tables apart- for example, the RDBMS very well may be able to avoid a lot of disk seeks (or reading a lot of unneeded data) when reading rows. It depends on your app and how it queries the data.
Upvotes: 0
Reputation: 26
Complete normalization is rarely the right approach for large complex databases.
Always think through the pros and cons of your models. Consider the following: Complexity, Performance, Maintenance, Evolution.
If your database is part of an evolving system, then you will almost certainly be changing your models (tables) and relationships at some point in the future.
As a rule of thumb, keeping your models close to real life will bring benefits in the long term. Especially when your client / user comes back with a new feature request.
Try to consider how you model your data in different ways. For example: Your current 'User' record sounds more like a 'Contact' record. Contact records may have other uses than storing system settings - Therefore keeping the two models as separate tables would be the correct solution - Even if the relationship does start out as 1:1.
Upvotes: 1
Reputation: 25534
Creating a separate table for user settings does not break the rules of normalization. If it makes sense for other reasons then I suggest you do it.
Upvotes: 0