Get every nth point in a given time range

Hello!

I am looking for a way to get every nth point in a given time range. Since I am working with sensor data, chances are, I don’t want to load all the data, just resample the data for creating charts.

The solutions I’ve tried

    select * from MEASUREMENT
    where  time >= FROMms and time <= TOms
    and   _id % SKIP = REMAINING

1st: Using modulo operation: This solution is OK for small time ranges. InfluxDB is very fast for selecting time ranges, but I believe it then has to check if each point in this time range satisfy the modulo operation or not (i.e. _id % 10 = 0).

2nd: Multiple select queries: Sending multiple requests for every nth element will take a lot of time, and It’s a bad solution anyway.

I appreciate if someone has a solution or any workarounds to this problem.

Thanks!
Omar

1 Like