Re: Sequential event query

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: Allan Kamau <allank(at)sanbi(dot)ac(dot)za>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Sequential event query
Date: 2008-06-25 17:03:39
Message-ID: 48627A6B.4030100@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Allan Kamau wrote:
> Hi Steve,
> Am having difficulties (there is a chance I could be the only one)
> trying to see how the results you've listed under "I would want to
> get:" section can be generated from the information you have provided
> in your implicit problem statement.
Remember the events are listed chronologically. Stated verbosely:

1: Value 1 happened 1 sequential time
3: Value 3 happened 1 sequential time
1: Value 1 happened 1 sequential time
4:
4: Value 4 happened 2 sequential times
5: Value 5 happened 1 sequential time
4 : Value 4 happened 1 sequential time
2:
2:
2 : Value 2 happened 3 sequential times
4:
4 : Value 4 happened 2 sequential times
7 : Value 7 happened 1 sequential time
4 : Value 4 happened 1 sequential time

So the summary is:
Event type 1 appeared in a cluster of 1 event 2 times
Event type 2 appeared in a cluster of 3 events 1 time
Event type 3 appeared in a cluster of 1 event 1 time
Event type 4 appeared in a cluster of 1 event 1 time
Event type 4 appeared in a cluster of 2 events 3 times
Event type 5 appeared in a cluster of 1 event 1 time
Event type 7 appeared in a cluster of 1 event 1 time

Given the summary table, I can then look at distributions of run-lengths
for different event-types. If I know the distributions for a system
operating normally, I can establish criteria to use for generating
alerts and alarms.

I have generated the above using external programs but if I can do so
with a query, I would prefer to do so.

Cheers,
Steve

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Steve Crawford 2008-06-25 17:12:43 Re: Sequential event query
Previous Message Greg Sabino Mullane 2008-06-25 14:20:53 Re: GROUP BY on a column which might exist in one of two tables