Learn to query data stored in InfluxDB using Flux and tools such as the InfluxDB user interface and the ‘influx’ command line interface.
Get started with Flux, the functional data scripting language, and learn the basics of writing a Flux query that queries InfluxDB.
influx query command executes a literal Flux query provided as a string or a literal Flux query contained in a file.
Guides that walk through both common and complex queries and use cases for Flux.
Use the InfluxDB 1.x
/query compatibility endpoint to query data in InfluxDB Cloud and InfluxDB OSS 2.4 with InfluxQL.
There are multiple ways to query data from InfluxDB including the InfluxDB UI, CLI, and API.
The InfluxDB v2 API includes InfluxDB 1.x compatibility endpoints that work with InfluxDB 1.x client libraries and third-party integrations like Grafana and others.
Optimize your Flux queries to reduce their memory and compute (CPU) requirements.
filter() to query data based on fields, tags, or any other column value.
filter() performs operations similar to the
SELECT statement and the
WHERE clause in InfluxQL and other SQL-like query languages.
Query InfluxDB using the InfluxDB user interface (UI) Data Explorer. Discover how to query data in InfluxDB 2.1 using the InfluxDB UI.
Learn the basics of using Flux to query data from InfluxDB.
Query InfluxDB with the InfluxDB API. Discover how to query data in InfluxDB 2.1 using the InfluxDB API.
Learn the basics of using Flux to transform data queried from InfluxDB.
Query InfluxDB using the Flux REPL. Discover how to query data in InfluxDB 2.5 using the Flux REPL.
Query InfluxDB using the influx CLI. Discover how to query data in InfluxDB 2.1 using
increase() to track increases across multiple columns in a table. This function is especially useful when tracking changes in counter values that wrap over time or periodically reset.
timedMovingAverage() to return the moving average of data.
derivative() to calculate the rate of change between subsequent values or
aggregate.rate() to calculate the average rate of change per window of time. If time between points varies, these functions normalize points to a common time interval making values easily comparable.
fill() function to replace null values.
median() to return a value representing the
0.5 quantile (50th percentile) or median of input data.
quantile() function to return all values within the
q quantile or percentile of input data.
cumulativeSum() function to calculate a running total of values.
last() to return the first or last point in an input table.
sql package provides functions for working with SQL data sources. Use
sql.from() to query SQL databases like PostgreSQL, MySQL, Snowflake, SQLite, Microsoft SQL Server, Amazon Athena, and Google BigQuery.
runtime.version() to return the version of Flux installed in InfluxDB.
/query 1.x compatibility endpoint queries InfluxDB Cloud and InfluxDB OSS 2.x using InfluxQL.
influx repl command opens an interactive Read-Eval-Print Loop (REPL) from which you can run Flux commands.