About Flux
Introduction to Flux
Flux (formerly IFQL) is the new InfluxDB query language and engine we already talked about at The history and future of InfluxDB - #2 by Andreas and Temperatursummen in der Imkerei - #7 by weef.
Flux is a lightweight scripting language for querying databases (like InfluxDB) and working with data. It’s part of InfluxDB 1.7 and 2.0, but can be run independently of those.
See also: Flux Specification.
Flux vs. InfluxQL
InfluxQL is InfluxData’s SQL-like query language for interacting with data in InfluxDB. Flux is an alternative to InfluxQL and other SQL-like query languages for querying and analyzing data. It uses functional language patterns making it incredibly powerful, flexible, and able to overcome many of the limitations of InfluxQL. This article outlines many of the tasks possible with Flux but not InfluxQL and provides information about Flux and InfluxQL parity.
– https://docs.influxdata.com/flux/v0.7/introduction/flux-vs-influxql/
Remark: Please follow this link to get an at-a-glance like introduction to Flux’s features by looking at things which haven’t been possible with InfluxQL.
Rationale for Flux
A Note on IFQL
The combination of schema-on-write, automatic indexing of
tagsets
, and SQL-like syntax produce a system that allows newcomers to be productive quickly, that feels familiar, and requires minimal setup to get started.However, the pre-allocation of narrowly scoped iterators means high-cardinality queries, and queries that produce a very large number of groups are expensive to plan. The iterator structures can consume, worst case, GBs of RAM. Secondly, the iterator allocation during planning and other implementation details make multi-query resource management difficult. Finally, while SQL-like syntax is a good fit for simple queries, it becomes cumbersome for more sophisticated analytics. Time series queries are often sets of functions applied to groupings of filtered streams. Expressing these queries using select-project-join logic with advanced SQL partition and over clauses requires an experienced SQL programmer and is no longer beginner- friendly.
We recently announced a prototype query language, IFQL, to explore solutions to these problems: cheaper planning, better resource management, and easier expression of complex queries.
– InfluxDB Internals 101 - Part Two | InfluxData (Nov, 2017)
Documentation
Articles
2017
2018
- Why We're Building Flux, a New Data Scripting and Query Language | InfluxData
- https://medium.com/worldsensing-techblog/playing-with-flux-a-data-scripting-language-27421391d32c
- How the New Influx Query Engine Was Designed—And How to Use It With Grafana | Grafana Labs
- SQL vs. Flux: Choosing the right query language for time-series data
The Design of IFQL, the New Influx Functional Query Language
by Paul Dix, the founder of InfluxData and principal architect of Flux (formerly IFQL):
The new InfluxDB query language is functional in nature. Conceptually it looks like D3 or jQuery. Functions are chained off each other. This gives greater flexibility for what the language can do and opens up new possibilities for UI builders. This talk will cover the details of the language and user interface ideas that can pair up nicely with it. We’ll look at query examples that perform math on metrics, interpolation, and similarity measures.
Important notes about Flux
Key concepts » Buckets
Flux introduces “buckets”, a new data storage concept for InfluxDB. A bucket is a named location where data is stored that has a retention policy. It’s similar to an InfluxDB v1.x “database,” but is a combination of both a database and a retention policy.
Specify a time range
Flux requires a time range when querying time series data. “Unbounded” queries are very resource-intensive and as a protective measure, Flux will not query the database without a specified range.