graphing time series data - Mailing list pgsql-sql

From Louis-David Mitterrand
Subject graphing time series data
Date
Msg-id 20100414145434.GA13682@apartia.fr
Whole thread Raw
Responses Re: graphing time series data  (Richard Broersma <richard.broersma@gmail.com>)
List pgsql-sql
Hi,

I have times series data in a 'price' table:

price(id_price, price, id_product, created, modified)

Prices are polled daily and a new 'price' row is created only if the
price of id_product changes, else modified is updated to now().

Now, I'd like to make a graph of average prices per week, per
id_product. As some prices don't vary much, distribution would not be
ideal if I simply 'group by extract(week from p.modified)'.

Ideally I'd generate_series() a list of weeks between min(p.created) and
max(p.modified) and then average prices 'group by p.modified < week'.

What would be the best way to tackle this?

Thanks,


pgsql-sql by date:

Previous
From: Mario Splivalo
Date:
Subject: Using CASE in plpgsql causes 'ERROR: cache lookup failed'
Next
From: Richard Broersma
Date:
Subject: Re: graphing time series data