Re: [SQL] selecting records X minutes apart

2011-06-05 Thread lists-pgsql
Thank you all who replied!! It looks like Sugawara's recursive solution does the trick. Unfortunately performance is quite poor for the sample dataset I'm working with which is a table of about 5 records. Indeed, there are indexes applied to the table. I believe the recursive select is bein

Re: [SQL] selecting records X minutes apart

2011-06-05 Thread Masaru Sugawara
On Fri, 3 Jun 2011 15:52:53 -0400 lists-pg...@useunix.net wrote: I also think you might want to use WITH RECURSIVE clause. This SQL searches the case of an interval of 5 minutes or more, and sets a relationship between a parent to its child. CREATE TABLE tbl(id integer, ts time) ; INSERT INTO

Re: [SQL] selecting records X minutes apart

2011-06-05 Thread Masaru Sugawara
On Fri, 3 Jun 2011 15:52:53 -0400 lists-pg...@useunix.net wrote: I also think you might want to use WITH RECURSIVE clause. This SQL searches the case of an interval of 5 minutes or more, and sets a relationship between a parent to its child. CREATE TABLE tbl(id integer, ts time) ; INSERT INTO