Mysql table question

Discussion in 'MySQL' started by Dirty-Rockstar, Jun 27, 2009.

  1. #1
    This should be an easy question because i am a database noob :). I built a text based game and my players are wishing for some statistics on how they play and what they do. I have thought of two ways to do this. one way was to add more fields to the user table. It already holds about 70 fields for regular much needed data like time stamps, security stats, password and username etc. basic per user needed stats.
    The stats I came up with will require 100+ new fields. Now, If I add those fields to the existing user table and call the specific data per user when they visit their "stats" page will it be slower then my second Idea of creating a new table that just holds stats. I do not use the wildcard query in any of my mysql on any page

    if i went with a new table I would need to add code to add the user to this stat table on signup and just run a script for the existing users to put them there. It would be easier for me to use the existing user table but with 70 fields so far im worried it would make the queries slower because of the amount of fields it will need to go through to find specific data.

    Now, assuming my code is optimized, which would be better...a new table, or use the existing one...or does it matter?

    Thank you
     
    Dirty-Rockstar, Jun 27, 2009 IP
  2. nishanair

    nishanair Active Member

    Messages:
    188
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #2
    use new table, i always split fields into separate tables.
     
    nishanair, Jun 27, 2009 IP
  3. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #3
    100+ new columns for statistics? I am afraid to ask, but can you post the table structure and the proposed new columns?

    I will be able to provide specific assistance. If you cannot post the structure or columns, I would recommend a new table.
     
    Social.Network, Jun 28, 2009 IP
  4. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The structure will be int(20) default 0 for every field, key will be the unique user ID assigned to the user on signup and the engine will be MyISAM. The names of the fields are irrelevant to my question sorry :p. I have decided to make a new table after doing some personal research. Thank you for the replies this forum has helped me so much in the last few years.
     
    Dirty-Rockstar, Jun 28, 2009 IP
  5. roseplant

    roseplant Peon

    Messages:
    253
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's a lot cleaner just to use another table PLAYER_STATS. In that table make a field USER_ID, which should be the same as the USER_ID field in the USERS table. That way it makes it very easy to match them up, do lookups, etc.
     
    roseplant, Jun 28, 2009 IP
  6. Social.Network

    Social.Network Member

    Messages:
    517
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    35
    #6
    The names are relevant to the question. For example, if you have defined stat_1, stat_2, stat_3, etc. or some similar strategy we can assist with the design. Oh well, I guess another table with 100 columns is the ONLY way to go. :rolleyes:
     
    Social.Network, Jun 28, 2009 IP