I have a database of time series data (temperature/weather readings) in an SQLite database. Sampling one data point per minute will give me half a million points per year, and when plotting over long timespans, it would be better to subsample the points, to spread them evenly.
If I want to query my database and receive max 1000 points, how can I do that? The relevant columns are (id INTEGER PRIMARY KEY, value REAL, timestamp INTEGER)
.
If there are less than 1000 points, I want to get all. If there are more, I want to get 1000 rows that have (approximately) even durations between the two.
This question does something similar, but does not seem to work in SQLite, only PostgreSQL.