SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    Victory shall be mine tubedogg's Avatar
    Join Date
    Mar 2001
    Location
    Medina, OH
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    question on how to set up a table

    Which of the following three would likely be least intensive on a busy system?

    PHP Code:
    CREATE TABLE forum (
        
    userid
        forumid

    Notes: possibly up to 500 or 600 forumids. Would have one row per forumid per user (possibly up to 50,000 or more users). Not necessarily all userid's will have a row for each forumid.

    PHP Code:
    CREATE TABLE forum (
        
    userid,
        
    forum1,
        
    forum2,
        
    forum3,
        ...,
        ...,
        ...,
        
    forum500,
        
    forum501,
        
    forum502

    Notes: One column for each forum, up to 500 or 600. One row per user. Not all columns will necessarily have a value for every user.

    PHP Code:
    ALTER TABLE user ADD COLUMN forumids MEDIUM TEXT
    Notes: Store forumids as comma-delimited list, explode'd into an array for use in the program. Length of actual list varies per user, but could be up to 500 or 600 items per list.

    Any thoughts on how I should go about this?
    I have obviously left off the details of each column such as type etc. but this is the basic idea.
    Last edited by tubedogg; Sep 3, 2001 at 04:08.
    Kevin

  2. #2
    SitePoint Enthusiast kcabobert's Avatar
    Join Date
    Aug 2001
    Location
    Topeka, KS
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My personal thoughts would be that the last would be the best in this case (for what I imagine your trying to do.) I think having a table with 600 columns and 50,000 rows would be a big mess (my thoughts.) The first table could potentially have 30,000,000 rows in a two-column table, which could also be an enormous fiasco. I think that the middle one gives the best all around solution, exploding the forumids into an array with a for loop (or while) would make that a quick easy solution.
    Microsoft's Motto: Resistance is futile, you will be assimilated.

    My dog's name is Jade; she is a Miniature pinscher.
    Click here to see some of her pictures


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •