best db schema for time series data?

From: Louis-David Mitterrand <vindex+lists-pgsql-performance(at)apartia(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: best db schema for time series data?
Date: 2010-11-16 10:50:55
Message-ID: 20101116105055.GA26129@apartia.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi,

I have to collect lots of prices from web sites and keep track of their
changes. What is the best option?

1) one 'price' row per price change:

create table price (
id_price primary key,
id_product integer references product,
price integer
);

2) a single 'price' row containing all the changes:

create table price (
id_price primary key,
id_product integer references product,
price integer[] -- prices are 'pushed' on this array as they change
);

Which is bound to give the best performance, knowing I will often need
to access the latest and next-to-latest prices?

Thanks,

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Pavel Stehule 2010-11-16 11:03:29 Re: best db schema for time series data?
Previous Message Pavel Stehule 2010-11-16 07:12:03 Re: