Re: time series data

From: Khalil Khamlichi <khamlichi(dot)khalil(at)gmail(dot)com>
To: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: time series data
Date: 2017-10-02 16:31:27
Message-ID: CAEK98WaTqRSQ-GEsfWzCEmdsosvdey7KOgPXHZVEPC_BrDcJTA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

interesting proposition, I am reading the docs.

On Mon, Oct 2, 2017 at 6:08 PM, Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>
wrote:

> On Sun, Oct 1, 2017 at 2:17 AM, Khalil Khamlichi
> <khamlichi(dot)khalil(at)gmail(dot)com> wrote:
> > Hi everyone,
> >
> > I have a data stream of a call center application coming in to postgres
> in
> > this format :
> >
> > user_name, user_status, event_time
> >
> > 'user1', 'ready', '2017-01-01 10:00:00'
> > 'user1', 'talking', '2017-01-01 10:02:00'
> > 'user1', 'after_call', '2017-01-01 10:07:00'
> > 'user1', 'ready', '2017-01-01 10:08:00'
> > 'user1', 'talking', '2017-01-01 10:10:00'
> > 'user1', 'after_call', '2017-01-01 10:15:00'
> > 'user1', 'paused', '2017-01-01 10:20:00'
> > ...
> > ...
> >
> > so as you see each new insert of an "event" is in fact the start_time of
> > that event and also the end_time of the previous one so should be used to
> > calculate the duration of this previous one.
> >
> > What is the best way to get user_status statistics like total duration,
> > frequency, avg ...etc , does any body have an experience with this sort
> of
> > data streams ?
>
> Have you looked at temporal_tables extension? It seems custom made for
> what you're trying to do.
>
> http://clarkdave.net/2015/02/historical-records-with-
> postgresql-and-temporal-tables-and-sql-2011/
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Khalil Khamlichi 2017-10-02 17:27:32 Re: time series data
Previous Message Scott Marlowe 2017-10-02 16:08:39 Re: time series data