How to query & filter for every N records

We are sampling data from sailboats and recording telemetry every second. However, when we visualize depending on the mapbox range we don’t need this resolution of data. For example, if our mapbox range is 1 mile we may only really want to return data that represented every 5 seconds or every 10 seconds. Is there a way we can handle this in the query itself so the resulting data sets are optimized and we can avoid having to filter out in the app code?

Hi Brian, we don’t have any native solution but you can overcome with some sql.
I remember this trick from union all can maybe help you.

I think you can go with UNION ALL and combine queries making only the mapbox range match with the right dataset. It will be a long sql but you can create a view to syntax sugar it.