Re: efficient data reduction (and deduping)

Поиск
Список
Период
Сортировка
От Peter van Hardenberg
Тема Re: efficient data reduction (and deduping)
Дата
Msg-id CAAcg=kVXjbd_CSaMQUB5iigXO5x+7QyX12z8xHueHd4_15p7nQ@mail.gmail.com
обсуждение исходный текст
Ответ на efficient data reduction (and deduping)  (Alessandro Gagliardi <alessandro@path.com>)
Ответы Re: efficient data reduction (and deduping)  (Alessandro Gagliardi <alessandro@path.com>)
Список pgsql-performance
On Thu, Mar 1, 2012 at 10:27 AM, Alessandro Gagliardi
<alessandro@path.com> wrote:
> Now, I want to reduce that data to get the last activity that was performed
> by each user in any given hour. It should fit into a table like this:
>

How about:

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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Craig James
Дата:
Сообщение: Re: efficient data reduction (and deduping)
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: efficient data reduction (and deduping)