Best way to store this type of data?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeddiki
    Contributor
    • Jan 2009
    • 290

    Best way to store this type of data?

    Hi,

    I have a daily feed to update my database table with.

    The feed contains this data:

    Product_code,
    Todays timestamp
    Description (300 chars)
    Daily Sales
    Product Price
    Product Cost

    There are over 20,000 products in the update file every day.

    95% of the products are already in the database from previous days but about 5% are new ones.

    The Description does NOT usually change, but it can do and I have to record it, keeping the old description and the date of change.

    So far, I have just been adding a row for each daily update, but this is wasting a lot of disk space because generally only two fields change (the timestamp and daily sales figure).

    I am trying to work out a better way of doing it.

    One thought is to check if there is any change to the Description, price etc and if there is not, just put a null in the field for that day. I assume that would save disk space ?

    Maybe a better way is to have two tables that are joined.

    Like this:

    Product_code,
    Todays timestamp
    Description (300 chars)
    Product Price
    Product Cost

    and:


    Product_code,
    Todays timestamp
    Daily Sales

    It is going to make the searches that I do on the databases more complicated, but maybe this is better?

    Any help would be appreciated
  • artov
    New Member
    • Jul 2008
    • 40

    #2
    What are these "Todays"? Why do you need them on both tables? Does it mean that you keep archive data of product information, i.e. what was price of a product at some todays, or what?

    Comment

    Working...