On Thu, Mar 1, 2012 at 10:40 AM, Peter van Hardenberg <pvh@xxxxxx> wrote:
> Now, I want to reduce that data to get the last activity that was performedHow about:
> by each user in any given hour. It should fit into a table like this:
>
1) Create an _expression_ based index on date_trunc('hour', hr_timestamp)
2) Create a view on that showing the last value
3) If you want to throw away the data use CREATE TABLE AS on the
results of the view.
You may also want to investigate window functions.
-p
--
Peter van Hardenberg
San Francisco, California
"Everything was beautiful, and nothing hurt." -- Kurt Vonnegut