This is a good suggestion. A drawback is that the interval can't be too small otherwise there is a risk that a sample would be missed. So I will get more samples than I need. In you example, if there is a sample every second more or less, I would usually get 3-4 samples every hour instead of just one which would suffice.
No, because of group by clause.
In reality I have around 5 samples every 300 seconds, and almost certainly at least one sample within 320 seconds. Then, most of the 5 samples will typically be within a few seconds, and rarely spread evenly across the 300 second interval. So the sampling is only semi-regular.
You're going to have at most one random sample in every slice of 320 s. The GROUP BY clause will select only one for you and the query can be as simple as:
select sample from from mytable group by timestamp / 320 order by timestamp;
Test on a temporary table taken as a small subset of your main table and see what gives. Increase 320 to whatever value is needed to grab at least one sample in every time slice.
_______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users