Re: Sequential event query - Mailing list pgsql-sql

From Steve Crawford
Subject Re: Sequential event query
Date
Msg-id 48627A6B.4030100@pinpointresearch.com
Whole thread Raw
In response to Re: Sequential event query  (Allan Kamau <allank@sanbi.ac.za>)
Responses Re: Sequential event query
List 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



pgsql-sql by date:

Previous
From: "Greg Sabino Mullane"
Date:
Subject: Re: GROUP BY on a column which might exist in one of two tables
Next
From: Steve Crawford
Date:
Subject: Re: Sequential event query