1. Aggregate select
SELECT with mean() aggregates the usage field, just like SQL aggregate functions.
SELECT mean("usage")Typorithm · medium
Step 1 of 8 · intro card
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.
SELECT/FROM/WHERE mirror SQL.
WHERE time > now() - 1h is a relative range.
GROUP BY time(5m) downsamples into windows.
SELECT mean("usage") FROM "cpu" WHERE time > now() - 1h GROUP BY time(5m), "host"Connect each part of the code to the concept before you type.
SELECT with mean() aggregates the usage field, just like SQL aggregate functions.
SELECT mean("usage")FROM names the measurement "cpu", the InfluxQL analogue of a table.
FROM "cpu"WHERE time > now() - 1h limits the query to the last hour using relative time.
WHERE time > now() - 1hGROUP BY time(5m) buckets results into 5-minute windows; "host" further groups by tag.
GROUP BY time(5m), "host"Read the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.