Search code examples
mysqldatabasedatabase-designnormalizationdenormalization

Does it still make sense to normalize data (1NF)? (what's wrong with having empty fields in a table?)


Given that disk space is cheap, does it make sense to normalize data (1NF) rather than store it all in one place for faster queries?

Background:

  1. We have a table of users - event organizers and event attendees
  2. Both have some common fields, but organizers have many more fields
  3. Attendees are far more numerous than organizers on the site

Question: (In the far past) We combined the separate tables which existed and made them into one similar to the following:

   Table_Users
   UID, Name, Email, CommonField1, OrgSpecificField1, OrgSpecificField2

Now, we have only one common table for both types of users. For attendees, the last two fields are NULL.

Compare the above structure to:

   Table_Users
   UID, Name, Email, CommonField1

   Table_UsersOrganizers
   UID, OrgSpecificField1, OrgSpecificField2

which would necessitate a JOIN. Now, from the site speed perspective, which would be faster to retrieve - the common-integrated table or the separated one? Remember that we would be constantly fetching these records.


Solution

  • If you are talking about the site speed in fetching data, then it is definitely the second choice (the separated table) The data retrieving time is mainly about the number of entries in the table (number of rows) which will be less in the separated ones