Please take into consideration this is a MySQL Question for Web Development.
Currently I'm designing the database structure for a User Authentication System and I came across one question, that I myself can't figure it out:
Is it better to have duplicated data instead of making more queries?
Here's a little background, currently my users table looks something like this (pseudo-code):
id mediumint
username varchar(15)
password varchar(100)
email varchar(80)
status tinyint(1) <- is the user banned?
language varchar(100)
private_message_counter mediumint
notify_email tinyint(1)
Extra rows
I'm trying to put all the "most used" rows into the users table, to prevent more queries for example:
With Indicator on users table:
-
User Logged on? (query Sessions)
Get User Data (query Users)
Get User Permissions (query permissions)
-
Without indicators:
-
User Logged on? (query Sessions)
Is the user Banned? (query Bans)
Get User Data (query Users)
Get User Permissions (query Permissions)
Get Private Message information (query private_messages table)
One little "problem" is that the users table ends with a lot of rows. It's obvious also that I'll need to run more checks to prevent data mismatch, but isn't the improvement way better?
Note: My Website has around 14,500 simultaneous users connected. So I need to know if it'll improve or do the complete opposite.
Any opinions or recommendations are welcomed.