List:General Discussion« Previous MessageNext Message »
From:Gavin Towey Date:March 30 2010 5:45pm
Subject:RE: Table Length Question...
View as plain text  
Not only should you definitely have one record per day, instead of one record per month,
you should think about normalizing your structure further.  Try these articles for tips
on how to design a database structure:

http://dev.mysql.com/tech-resources/articles/intro-to-normalization.html and
http://mysqldump.azundris.com/archives/20-Nermalisation.html and some here
http://www.keithjbrown.co.uk/vworks/mysql/

Good luck!

Regards,
Gavin Towey

-----Original Message-----
From: Steven Staples [mailto:sstaples@stripped]
Sent: Tuesday, March 30, 2010 8:36 AM
To: mysql@stripped
Subject: Table Length Question...

Hi there,

I currently store some information about a users daily habits in a table.
The table has 4 fields per day, and another 4 fields as the keys.  This
table, depending on the month, can be from (4 keys + (28 days * 4 fields per
day)) fields, to (4 keys + (31 days * 4 fields per day)) fields long...

The table layout is like such:
+-----+---+----+-----+------+------+------+------+------+------+------------
--
|name |id |id2 |type |d01f1 |d01f2 |d01f3 |d01f4 |d02f1 |d02f2 |.....and so
on
+-----+---+----+-----+------+------+------+------+------+------+------------
--

Performance wise, would it be better to have it laid out in a manner such as
+-----+---+----+-----+----+---+---+---+---+
|name |id |id2 |type |day |f1 |f2 |f3 |f4 |
+-----+---+----+-----+----+---+---+---+---+
So that each row, contains a single days details, rather than have a single
row, contain the entire months details?

Also, when i would do a select, if i wanted say d02f1, would it load the
entire row first, and then just give me that field?
-Select `d02f01` from `mytable` where [where clause]
Or would it jsut load that field...

Does these questions make sense?  (they do in my head)

Steven Staples



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=1


This message contains confidential information and is intended only for the individual
named.  If you are not the named addressee, you are notified that reviewing,
disseminating, disclosing, copying or distributing this e-mail is strictly prohibited. 
Please notify the sender immediately by e-mail if you have received this e-mail by
mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed
to be secure or error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not
accept liability for any loss or damage caused by viruses or errors or omissions in the
contents of this message, which arise as a result of e-mail transmission. [FriendFinder
Networks, Inc., 220 Humbolt court, Sunnyvale, CA 94089, USA, FriendFinder.com
Thread
Table Length Question...Steven Staples30 Mar
  • RE: Table Length Question...Gavin Towey30 Mar
  • Re: Table Length Question...Chris W30 Mar