Search code examples
databasetime-seriesinfluxdb

fetching specific data range from influxDb


In my application I am displaying data fetched from influxDb, in a table. The table has pagination and the max number of row for each page is 10.

I am fetching initial data in a 100 item packages. Therefore, on initial data fetch, there are 100 data rows (from row1 to row100), meaning 10 pages on table... But I will let the user directly jump to, say 280th page. Which means I need data from row2790 to row2800...

I am not proficient in influx yet. I know it is possible to specify time range. But here I need to get data not according to date but according the data row number when sorted (_time / descending)... How is it possible go get data (for ex.) from row2790 to row2800 directly, without fetching all data from row100 to row2800? (I kind of want to reduce the time to fetch data the user wants to see so specifically give the exact range of data) Thanks.


Solution

  • The answer is:

    |> limit(n: 10, offset: 2790)
    

    Check: https://docs.influxdata.com/flux/v0/stdlib/universe/limit/