1

I'm new with Influx, and although I can get range, filter, sort and group to work, I just can't get limit to work.

I'm using Influx OSS 2.3 and I'd assume the query should look like this:

from(bucket: "readings") 
    |> range(start: - 1d) 
    |> limit(n:10)

I've tried both through the Data explorer and the C# sdk, but it always returns 400 records.

If I use offset I'm not getting any records:

from(bucket: "readings") 
    |> range(start: - 1d) 
    |> limit(n:10, offset:2)

Thanks for the help

wmmhihaa
  • 744
  • 8
  • 21
  • 1
    The limit is per table (series). How many tables does the result with 400 records comes in, if you check raw data result in Data explorer? – alespour Aug 15 '22 at 12:00

1 Answers1

1

I believe @alespour was on the right track. If you have tags, these will implicitly group the data into independent tables. In flux, each operation is applied to each table independently, so if you have 40 distinct tag values, a call to limit(n: 10) would return 400.

Using group() with no arguments will drop grouping and the number of records you specify will be applied to all results.

from(bucket: "readings") 
    |> range(start: - 1d) 
    |> group()
    |> limit(n:10)
Matt Summersgill
  • 4,054
  • 18
  • 47