Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I'm designing a web application, something small but deals with lots of read and inserts. Let's say 60% read and 40% writes. My storage engine is InnoDB on MySQL. I have a table called User which has a bunch of stuff in it. I broke it down into smaller tables such as address table and bio table. Here is an example :

Original table

User table
----------
user_id   PK
user_email
user_pass
user_dob
user_gender
user_country
user_state
user_city

After breaking it down

User table
----------
user_id   PK
user_email
user_pass

Bio Table
----------
user_dob
user_gender

Address Table
-------------
user_country
user_state
user_city

So do you guys think, having smaller table but several of them is better for a high traffic database or should I keep them all in one table ?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

This is how I see it, it's better to have it separate, that's relational database

If N User can have 1 address, the design should be:

enter image description here

if N user can have M address (user with more address, and an address for multiples user), should be: enter image description here

For both design, the table USER, Column ID is the Primary key of that table, and User_id is just a FK. In the second design, Table Address, column ID, it's another PK, that make a relation N:M with user, and create "user_has_table" with 2 foreign keys (user PK and address PK).

share|improve this answer
    
Thanks a lot :) –  Alex May 14 '12 at 20:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.