Best Storage Practise (user groups)

Discussion in 'Databases' started by chopsticks, Feb 28, 2008.

  1. #1
    Hi,

    I'm pondering the best way to add a feature to my site which will have minimal effect on other areas of the site. Basically it is a network/group feature similar to that on Facebook where you can have networks like Australia, France etc (minus all the extra features such as bbs and such).

    What would be the best table/field layout to use for such an item?

    I noticed some applications where they have a groups userlist table and then another table which had a groups name and other details such as:

    group_users (table)
    - group_id
    - user_id
    - user_status
    - user_etc

    group_information (table)
    - group_id
    - group_name
    - group_etc

    ... and connecting them by group_id.

    Is there any other ways that it could be done in a more efficient manner? Judging by using something like the above the group_users table would get absolutely massive.
     
    chopsticks, Feb 28, 2008 IP
  2. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #2
    I would probably switch the order of user_id and group_id in the users table but otherwise, that looks good. Make sure you make an index on group_id in the users table.
     
    jestep, Feb 29, 2008 IP