in reply to Re: PostgreSQL cursors with Perl.
in thread PostgreSQL cursors with Perl.

I have quotes data for around 15 currency pairs (like 'EUR/USD', 'USD/JPY' etc). For every currency pair there is a separate table (there are no inter-table joins) of a following structure:

id => int primary key, timestamp => bigint, # epoch timestamp in milliseconds bid => decimal, ask => decimal, bid_amount => int, ask_amount => int, data => varchar # lots of additional data that # need not to be indexed nor normalized

The queries look like:

SELECT * FROM table WHERE timestamp > ? AND timestamp < ?

Or:

SELECT MAX(bid), MIN(bid), MAX(ask), MIN(ask) FROM table WHERE timestamp > ? AND timestamp < ?