Re: grouping by time interval - Mailing list pgsql-novice

From Michael Lush
Subject Re: grouping by time interval
Date
Msg-id Pine.LNX.4.64.0904031037170.24342@pigeon.ebi.ac.uk
Whole thread Raw
In response to Re: grouping by time interval  (Larry Rosenman <ler@lerctr.org>)
List pgsql-novice
On Wed, 1 Apr 2009, Larry Rosenman wrote:
> On Wed, 1 Apr 2009, Michael Lush wrote:
>> I'm writing a photo database for my family photos.  I've got a massive back
>> log so I'd like to some large scale annotation and break things up into
>> manageable chunks.
>>
>> I think one useful assumption would be tha any set of photos taken within
>> of a few seconds of each other (say 5 or less) are /probably/ about the
>> same subject...
>>
>> How would I go about detecting and marking events where the time interval
>> between two photos is less than 5 seconds
>>
> [snip]
>
> Have a look at the OVERLAPS operator.

Thanks!  That gets me to pairs of dates/IDs,  where should I look to find
out how to extract and number the clusters of IDs?

photo_id  | photo_time          | photo_group
         1 | 2005-08-20 19:05:15 |
         2 | 2005-08-20 19:12:59 |  1
         3 | 2005-08-20 19:13:03 |  1
         4 | 2005-08-21 19:13:07 |  1
         6 | 2005-08-21 13:02:48 |
         8 | 2005-08-21 13:06:06 |  2
         9 | 2005-08-21 13:06:10 |  2
        10 | 2005-08-21 13:06:19 |

ie if 2 and 3 are about the same thing and 3 and 4 are about the same
thing, 2 and 4 are likely to be about the same thing, even though they
were taken more than 5 seconds apart.

--
Michael
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Michael John Lush PhD                   Tel:44-1223 492626
Bioinformatician
HUGO Gene Nomenclature Committee        Email: hgnc@genenames.org
European Bioinformatics Institute
Hinxton, Cambridge
URL: http://www.genenames.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



pgsql-novice by date:

Previous
From: Mary Anderson
Date:
Subject: constraint is not dropped when table is dropped (maybe php related???)
Next
From: "Just E. Mail"
Date:
Subject: RPM for CentOS