Documentation

window() function

window() groups records using regular time intervals.

The function calculates time windows and stores window bounds in the _start and _stop columns. _start and _stop values are assigned to rows based on the row’s _time value.

A single input row may be placed into zero or more output tables depending on the parameters passed into window().

This function is intended to be used when timeColumn (_time by default) is not in the group key. If timeColumn is in the group key, resulting output is confusing and generally not useful.

Window by calendar months and years

every, period, and offset parameters support all valid duration units, including calendar months (1mo) and years (1y).

Window by week

When windowing by week (1w), weeks are determined using the Unix epoch (1970-01-01T00:00:00Z UTC). The Unix epoch was on a Thursday, so all calculated weeks begin on Thursday.

Function type signature
(
    <-tables: stream[A],
    ?createEmpty: bool,
    ?every: duration,
    ?location: {zone: string, offset: duration},
    ?offset: duration,
    ?period: duration,
    ?startColumn: string,
    ?stopColumn: string,
    ?timeColumn: string,
) => stream[B] where A: Record, B: Record

For more information, see Function type signatures.

Parameters

every

Duration of time between windows.

period

Duration of windows. Default is the every value.

period can be negative, indicating the start and stop boundaries are reversed.

offset

Duration to shift the window boundaries by. Default is 0s.

offset can be negative, indicating that the offset goes backwards in time.

location

Location used to determine timezone. Default is the location option.

timeColumn

Column that contains time values. Default is _time.

startColumn

Column to store the window start time in. Default is _start.

stopColumn

Column to store the window stop time in. Default is _stop.

createEmpty

Create empty tables for empty window. Default is false.

tables

Input data. Default is piped-forward data (<-).

Examples

Window data into 30 second intervals

data
    |> window(every: 30s)

View example input and output

Window every 20 seconds covering 40 second periods

data
    |> window(every: 20s, period: 40s)

View example input and output

Window by calendar month

data
    |> window(every: 1mo)

View example input and output


Was this page helpful?

Thank you for your feedback!


InfluxDB 3.9: Performance upgrade preview

InfluxDB 3 Enterprise 3.9 includes a beta of major performance upgrades with faster single-series queries, wide-and-sparse table support, and more.

InfluxDB 3 Enterprise 3.9 includes a beta of major performance and feature updates.

Key improvements:

  • Faster single-series queries
  • Consistent resource usage
  • Wide-and-sparse table support
  • Automatic distinct value caches for reduced latency with metadata queries

Preview features are subject to breaking changes.

For more information, see:

Telegraf Enterprise now in public beta

Get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

See the Blog Post

The upcoming Telegraf Enterprise offering is for organizations running Telegraf at scale and is comprised of two key components:

  • Telegraf Controller: A control plane (UI + API) that centralizes Telegraf configuration management and agent health visibility.
  • Telegraf Enterprise Support: Official support for Telegraf Controller and Telegraf plugins.

Join the Telegraf Enterprise beta to get early access to the Telegraf Controller and provide feedback to help shape the future of Telegraf Enterprise.

For more information:

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On May 27, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2