Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Tom Smith
Yeah. I am looking for fastest possible method that Postgresql would use its internal data structure knowledge to walk through the timestamp index and resturns every "nth" row On Mon, Jan 25, 2016 at 5:56 AM, Simon Riggs wrote: > On 25 January 2016 at 09:44, Matija Lesar wrote: > > >> you can a

Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Simon Riggs
On 25 January 2016 at 09:44, Matija Lesar wrote: > you can accomplish this with row_number() > > : > > WITH data_cte as ( > SELECT > id, > clock_timestamp() as ctimestamp > FROM gener

Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Vik Fearing
On 01/25/2016 09:55 AM, Tom Smith wrote: > Thanks, the solution would work for fixed interval timestamp. > But the data I am dealing with has irregular timestamp so can not be > generated with exact steps. > > I would consider this a special case/method of random sampling, evenly > distributed sam

Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Matija Lesar
On 25 January 2016 at 09:55, Tom Smith wrote: > Thanks, the solution would work for fixed interval timestamp. > But the data I am dealing with has irregular timestamp so can not be > generated with exact steps. > > I would consider this a special case/method of random sampling, evenly > distribut

Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Tom Smith
Thanks, the solution would work for fixed interval timestamp. But the data I am dealing with has irregular timestamp so can not be generated with exact steps. I would consider this a special case/method of random sampling, evenly distributed sampling according to the defined timestamp index. On

Re: [GENERAL] TABLESAMPLE usage

2016-01-25 Thread Vik Fearing
On 01/25/2016 05:09 AM, Tom Smith wrote: > Hello: > > I have a big table with that is always appended with new data with a unique > sequence id (always incremented, or timestamp as unique index) each row. > I'd like to sample, say 100 rows out of say 1000 rows evently across all > the rows, > so

[GENERAL] TABLESAMPLE usage

2016-01-24 Thread Tom Smith
Hello: I have a big table with that is always appended with new data with a unique sequence id (always incremented, or timestamp as unique index) each row. I'd like to sample, say 100 rows out of say 1000 rows evently across all the rows, so that it would return rows of1, 101, 201, 301you g