pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas <maps.on@gmx.net>
To: pgsql-sql@postgresql.org
Subject: How to find events within a timespan to each other?
Date: Wed, 07 Jul 2010 23:20:15 +0200
Message-ID: <4C34EF8F.5010202@gmx.net> (raw)

  Hi,

is there a way to find events in a log that happen within a certain 
timespan to each other?

Log is like this
event_id        integer   not null   default 0      primary key
event_type_id        integer   not null   default
user_id        integer   not null   default 0
event_ts      timestamp(0)

I need every event of a type that happened more often than one time 
within 5 minutes of another one of the same user.

17    3     1         ... 12:00
18    2     ....
19    3     1         ... 13:03
20    3     2         ... 13:03
21    3     1         ... 13:04
22    2    .....
23    3     1         ... 13:05
24    2     1         ... 13:06

E.g. the checked event_typ_id may be 3 then the result should be line 
19, 21, 23



regards
Andreas  :)



view thread (2+ messages)  latest in thread

Message-ID: <4C34EF8F.5010202@gmx.net>
Permalink:  ../4C34EF8F.5010202@gmx.net/
Also on:    postgresql.org/message-id/4C34EF8F.5010202@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: maps.on@gmx.net
  Subject: Re: How to find events within a timespan to each other?
  In-Reply-To: <4C34EF8F.5010202@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox