Skip to main content
Downsample your data to visualize trends while preserving fewer data points. Downsampling replaces a set of values with a much smaller set that is highly representative of the original data. This is particularly useful for graphing applications where displaying millions of points would be inefficient and visually overwhelming. TimescaleDB Toolkit provides two downsampling algorithms:
  • LTTB (Largest Triangle Three Buckets): Retains visual similarity between the downsampled data and the original dataset by selecting points that form the largest triangles
  • ASAP smooth: Preserves the approximate shape and larger trends while minimizing local variance between points

Samples

Downsample with LTTB

Downsample a sine wave dataset from 168 points to approximately 8 points using LTTB:

Downsample with gap preservation

Use gap-preserving LTTB to downsample data while maintaining boundaries of missing regions:

Downsample with ASAP smoothing

Smooth and downsample data to show larger trends while minimizing local variance:

Available functions

LTTB algorithm

  • lttb(): downsample using the Largest Triangle Three Buckets method
  • gp_lttb(): downsample using LTTB while preserving gaps in data

ASAP smoothing