Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-04 Thread Greg Smith
Tom wrote: 1. taking the primary key (which is an auto increasing integer) and running modulo on it. This will not work in my case as the database is being used for a number of different logging 'runs', and these runs are not necessarily equally distributed over the primary keys. Problem #1 wi

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-04 Thread Grzegorz Jaƛkiewicz
why create another table, straightforward on 8.4: SELECT * FROM (SELECT *, (row_number() OVER( ORDER BY id))%10 AS rn FROM table) sa WHERE sa.rn=1 LIMIT 10;

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-04 Thread A. Kretschmer
In response to Ivan Voras : > A. Kretschmer wrote: > >In response to Tom : > >>I have a big table that is used for datalogging. I'm designing > >>graphing interface that will visualise the data. When the user is > >>looking at a small daterange I want the database to be queried for all > >>records,

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-04 Thread Ivan Voras
A. Kretschmer wrote: In response to Tom : I have a big table that is used for datalogging. I'm designing graphing interface that will visualise the data. When the user is looking at a small daterange I want the database to be queried for all records, but when the user is 'zoomed out', looking at

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-04 Thread A. Kretschmer
In response to Richard Broersma : > On Thu, Dec 3, 2009 at 9:26 PM, Tom wrote: > > > I > > want run a query that skips every nth record and returns a managable > > dataset that still gives a correct overview of the data without > > slowing the programme down. Is there an easy way to do this that

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-03 Thread A. Kretschmer
In response to Tom : > I have a big table that is used for datalogging. I'm designing > graphing interface that will visualise the data. When the user is > looking at a small daterange I want the database to be queried for all > records, but when the user is 'zoomed out', looking at an overview, I

Re: [GENERAL] SELECTing every Nth record for better performance

2009-12-03 Thread Richard Broersma
On Thu, Dec 3, 2009 at 9:26 PM, Tom wrote: > I > want run a query that skips every nth record and returns a managable > dataset that still gives a correct overview of the data without > slowing the programme down. Is there an easy way to do this that I > have overlooked? I looked at: I've played

[GENERAL] SELECTing every Nth record for better performance

2009-12-03 Thread Tom
I have a big table that is used for datalogging. I'm designing graphing interface that will visualise the data. When the user is looking at a small daterange I want the database to be queried for all records, but when the user is 'zoomed out', looking at an overview, I want run a query that skips e