Typorithm · medium

InfluxQL

influxql-queryinfluxdbinfluxqldownsamplingaggregation
Saved on this device
Full lesson · 8 learning steps Open any exercise for focused practice
1

Step 1 of 8 · intro card

Learn InfluxQL

0%

Buckets & InfluxQL

InfluxQL is a SQL-like dialect: familiar SELECT/WHERE time/GROUP BY time() downsamples series into time windows.

InfluxQL borrows SQL syntax so SELECT, FROM, WHERE, and GROUP BY all feel familiar to anyone who knows SQL.

WHERE time > now() - 1h filters by a relative time range, and GROUP BY time(5m) downsamples points into 5-minute windows.

Newer InfluxDB favors Flux, a functional pipeline language, but InfluxQL stays popular for its SQL-like readability.

01

SELECT/FROM/WHERE mirror SQL.

02

WHERE time > now() - 1h is a relative range.

03

GROUP BY time(5m) downsamples into windows.

SELECT mean("usage") FROM "cpu" WHERE time > now() - 1h GROUP BY time(5m), "host"

Read the implementation

Connect each part of the code to the concept before you type.

1. Aggregate select

SELECT with mean() aggregates the usage field, just like SQL aggregate functions.

SELECT mean("usage")

2. Measurement source

FROM names the measurement "cpu", the InfluxQL analogue of a table.

FROM "cpu"

3. Time-range filter

WHERE time > now() - 1h limits the query to the last hour using relative time.

WHERE time > now() - 1h

4. Downsample window

GROUP BY time(5m) buckets results into 5-minute windows; "host" further groups by tag.

GROUP BY time(5m), "host"

A complete learning loop

01

Understand

Read the concept map and follow the code breakdown.

02

Reconstruct

Type the implementation, repair mistakes and work through every recall exercise.

03

Verify

Use the final check without hints; revisit weak concepts in short practice sessions.

InfluxQL: Lesson & Practice · Typorithm | ApplyDjinn