DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: Will creating another help

  1. #1
    Join Date
    Mar 2007
    Posts
    1

    Will creating another help

    I have a table with 30 fields for product specific information.

    Table has 200000 rows. Now i need to add another 15 columns for another
    product. Most of the earlier fields will never be used for this product.

    Do i create a new table for these 15 columns or just add them to the
    existing table.

    Thanks for your suggestions in advance.

    P

  2. #2
    Join Date
    Feb 2005
    Posts
    158
    200,000 is pretty small so physical restructuring shouldn't be an issue.
    From a normalisation point of view, it looks like you really have product types or classes, and some attributes only relate to certain product types.
    An analogy might be a firm selling some physical products (such as car batteries and tyres) and some services (such as an oil change). There are some attributes (such as weight and stock levels) that apply only to physical products and some that only apply to services (eg duration) and some that apply to both (eg cost).
    A properly normalised database would have a product table [with product id, product type, cost attributes], plus a physical product table [with product id, weight, stock] and a service table [product id, duration]
    There are benefits in properly normalising the database structure (constraints are easier - eg you define WEIGHT as NOT NULL on physical products, whereas if you used a single table, you'd need more complex multi-column check constraints), and the optimizer is better informed).

    When changing an existing application, you'll need to do more work if you are restructuring the database to normalise it. In the long term, the effort is probably worth it.

Posting Permissions

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


Click Here to Expand Forum to Full Width