InfluxDB

Thursday, March 16th 2023

InfluxDB is an open-source time series database that is designed to handle high volume, high frequency data streams. Time series data is a series of data points that are indexed in time order, typically collected at regular intervals.

InfluxDB was created to solve the problem of storing and querying time series data in a scalable and efficient manner. It uses a unique data model that is optimized for time series data, which allows for faster querying and more efficient storage.

InfluxDB supports a variety of data ingestion methods including HTTP API, Telegraf agent, and a number of client libraries for popular programming languages. It also provides a query language called InfluxQL, which is designed to make it easy to perform complex queries on time series data.

In addition to its open-source offering, InfluxDB also provides a commercial offering called InfluxDB Cloud, which is a fully managed cloud-based version of the database. InfluxDB Cloud provides additional features such as automatic scaling and advanced monitoring and alerting capabilities.

Other query languages

In addition to InfluxQL, InfluxDB also supports a new query language called Flux. Flux is a functional data scripting language designed specifically for querying and processing time series data.

Flux provides more advanced features such as support for complex joins and filtering, and also allows for data transformation and manipulation using functional programming concepts like maps and filters.

While InfluxQL is still the default query language for InfluxDB, Flux is quickly gaining popularity among InfluxDB users due to its more powerful features and flexibility.

It's worth noting that InfluxDB also supports SQL querying via an SQL interface that translates SQL queries to InfluxQL queries. This allows users who are more familiar with SQL to query InfluxDB using familiar syntax. However, it's important to keep in mind that SQL is not optimized for time series data and may not be the most efficient way to query InfluxDB.

Example queries for InfluxQL and Flux

InfluxQL

SELECT mean("value") FROM "measurement" WHERE "tag"='value1' AND time >= now() - 1h GROUP BY time(1m)

Flux query

from(bucket: "my-bucket") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "measurement" and r.tag == "value1") |> mean(column: "value") |> group(columns: ["_time"]) |> window(every: 1m)

This Flux query performs the same calculation as the InfluxQL query, but with some differences in syntax. Here, we specify the name of the bucket where the data is stored and use functional-style programming to perform filtering, averaging, grouping, and windowing operations.

It's worth noting that while the syntax is different, the underlying concepts and operations are the same. Both InfluxQL and Flux can be used to perform similar calculations and operations on time series data in InfluxDB.