Database structure question

Discussion in 'PHP' started by absentx, Feb 20, 2011.

  1. #1
    Hello,

    I would still consider myself in the "beginners" stage for php and mysql programming and I have a quick question about structuring a database.

    Right now I have a website that eventually will have a product database of about 2500 items. I didn't realize it would grow to be this big, I thought at the begining it would have one or two hundred records at most.

    Basically I have all the products in one big table and I usually find them by "product_type" and there will eventually be about thirty or forty different product types.

    Is the best idea to eventually have thirty or forty different tables (one for each product type) or is keeping all of the products in one big table an okay option as well?

    Ultimately I do not yet posses enough programming knowledge to realize which option is better. Or if it is not so much a matter of which option is better, rather which one works best for my situation?

    Any help is appreciated!
     
    absentx, Feb 20, 2011 IP
  2. srisen2

    srisen2 Peon

    Messages:
    359
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    keeping them in one table is fine you can have millions of lines in a database table and still operate just fine. Just keep the product type and other variable you want to use to distinguish the products from each other
     
    srisen2, Feb 20, 2011 IP
  3. ka4ok85

    ka4ok85 Peon

    Messages:
    13
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    For sure you don't need to create a new table for each product type. You can keep them all in one table, but if you have a lot of fields you can split this table into two: keep in first data you request often i.e. ID, name, price and in second store additional information. Of course if you have only 2550 rows it will not give you more speed.
     
    ka4ok85, Feb 24, 2011 IP