Re: Best way to do this query.. - Mailing list pgsql-sql

From Richard Broersma Jr
Subject Re: Best way to do this query..
Date
Msg-id 20060825204057.31139.qmail@web31810.mail.mud.yahoo.com
Whole thread Raw
In response to Best way to do this query..  ("Henry Ortega" <juandelacruz@gmail.com>)
Responses Re: Best way to do this query..  ("Henry Ortega" <juandelacruz@gmail.com>)
List pgsql-sql
> I have the following:
> 
> name      effective         tstamp                                   rate
> John       01-01-2006     2005-12-07 13:39:07.614945    115.00
> John       01-16-2006     2006-01-07 13:39:07.614945    125.00
> John       01-16-2006     2006-01-09 15:13:04.416935    1885.00
> 
> I want the output to be:
> name      effective         end_date        rate
> John       01-01-2006     01-15-2006    115.00
> John       01-16-2006                         1885.00
> 
> What is the best way to do this? This is on a huge table and what I
> have right now is quite slow. Any ideas?

I would assume that your data does not change after it is logged.  If this is the case, maybe this
part of your data model would actually be a good canidate for an OLAP data model.

If this is not the direction your are enterested in moving,  you could also reduce your query
processing time by limiting the data ranges for your existing query to something for reasonable.

Regards,

Richard Broersma Jr.


pgsql-sql by date:

Previous
From: Andrew Sullivan
Date:
Subject: Re: Best way to do this query..
Next
From: "Henry Ortega"
Date:
Subject: Re: Best way to do this query..