best db schema for time series data?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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,

-- 
Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance


[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux