jiazou/4bp — comment on commit fa22fea2562c59d57b42e69c5deac2146636a607
File: Abp/base_model/models.py line 50
By jiazou:

ahh ok ic what you are saying. yep makes sense. I'll try to get this done
by tmr. I have something else I need to finish today.

Jia

On Tue, Jan 3, 2012 at 12:39 AM, zhanghao8301 <
reply@reply.github.com
> wrote:

> from what I understand ProductPriceHistory is a table that has three
> columns:
> Product ID | DateTime | Price.
>
> So if we store the, say price for product id = 1 for 6 days, then we need
> 6 rows to store all the information.
>
> While this is feasible, SELECT will be quite expensive. For example, if we
> only use product id as the primary key, it means select will go through all
> the table rows to find those matched with a certain date range. If we use
> product ID AND datetime as primary key, then storing the database with
> two-keys chained won't be that efficient.
>
> If we store everything as a field in the database, something like
>
> Product ID | Serialized Price History
>
> then it would be more efficient for future queries.
>
> ---
> Reply to this email directly or view it on GitHub:
>
> https://github.com/jiazou/4bp/commit/fa22fea2562c59d57b42e69c5deac2146636a607#commitcomment-832930
>