Documentation

Flux reference documentation

All Flux reference material is provided in the Flux documentation:

View the Flux documentation

Flux with the InfluxDB IOx storage engine

When querying data from an InfluxDB bucket powered by InfluxDB IOx, use the following input functions:

Both IOx-based input functions return pivoted data with a column for each field in the output. To unpivot the data:

  1. Group by tag columns.
  2. Rename the time column to _time.
  3. Use experimental.unpivot() to unpivot the data. All columns not in the group key (other than _time) are treated as fields.
import "experimental"
import "experimental/iox"

iox.from(bucket: "example-bucket", measurement: "example-measurement")
    |> range(start: -1d)
    |> group(columns: ["tag1", "tag2". "tag3"])
    |> rename(columns: {time: "_time_"})
    |> experimental.unpivot()
import "experimental"
import "experimental/iox"

query = "SELECT * FROM \"example-measurement\" WHERE time >= now() - INTERVAL '1 day'"

iox.sql(bucket: "example-bucket", query: query)
    |> group(columns: ["tag1", "tag2". "tag3"])
    |> rename(columns: {time: "_time_"})
    |> experimental.unpivot()

Flux performance with InfluxDB IOx

When querying data from an InfluxDB bucket powered by InfluxDB IOx, using iox.from() is less performant than querying a TSM-powered bucket with from(). For better Flux query performance, use iox.sql().


Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB 3.0

The new core of InfluxDB built with Rust and Apache Arrow. Available today in InfluxDB Cloud Dedicated.

Learn more

State of the InfluxDB Cloud Serverless documentation

The new documentation for InfluxDB Cloud Serverless is a work in progress. We are adding new information and content almost daily. Thank you for your patience!

If there is specific information you’re looking for, please submit a documentation issue.

InfluxDB Cloud Serverless powered by IOx