From: Louis-David Mitterrand <vindex+lists-pgsql-performance@apartia.org>
To: pgsql-performance@postgresql.org
Subject: best db schema for time series data?
Date: Tue, 16 Nov 2010 11:50:55 +0100
Message-ID: <20101116105055.GA26129@apartia.fr> (raw)
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,
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: vindex+lists-pgsql-performance@apartia.org
Subject: Re: best db schema for time series data?
In-Reply-To: <20101116105055.GA26129@apartia.fr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox