Downsample data with notebooks
Downsample data to reduce the overall disk usage as data collects over time. Learn how to create a notebook that downsamples data—walk through the following example to create a notebook that does the following:
- Inputs InfluxDB Cloud demo data from the Website Monitoring Bucket
- Downsamples data by aggregating data within windows of time with a Flux script
- Outputs downsampled data to a bucket
- This example uses InfluxDB Cloud demo data.
- Create a destination bucket to write downsampled data to. For details, see Create a bucket.
Downsample data with a notebook
- Create a new notebook (see Create a notebook).
- Add a Metric Selector cell to select a bucket to query data from:
- In the Choose a bucket dropdown list, select Website Monitoring Bucket.
- Select the response_time field.
- Select the mean function from the aggregate selector in the upper-right.
- Add a Flux Script cell with the following script to bring in data from the previous cell and downsample it:
__PREVIOUS_RESULT__ |> aggregateWindow(fn: mean, every: 1h)
every duration is longer the the total time range queried, aggregateWindow will only return one value.
- Click Run from the Preview dropdown list to run the notebook and write to the output bucket a single time.
- To write continuously, click Export as Task in the upper right corner of the Output to Bucket cell. For details about working with tasks, see Manage tasks.
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, the following resources are available:
InfluxDB Cloud and InfluxDB Enterprise customers can contact InfluxData Support.