Skip to main content

Downsampling

Downsampling reduces the number of data points returned in query results while preserving visual fidelity. It is applied as a post-processing step in the Router after query results are merged.

Algorithms

ModeAlgorithmDescriptionPoints per Bucket
noneNo downsamplingAll
autoAuto-detectSelects best algorithm based on data spikinessVaries
lttbLargest-Triangle-Three-BucketsBest visual fidelity for smooth data1
minmaxMin-Max per bucketPreserves peaks and valleys2
avgAverage per bucketFast, computed averaged values1
m4First-Min-Max-LastBest shape preservation4

Auto Mode

When downsampling=auto, the system analyzes data characteristics to select the best algorithm:

  1. Calculates a spikiness score (0–1) based on:

    • Absolute deviation > 2σ from mean
    • Derivative spikes (rate of change > 1σ)
  2. Selects algorithm based on data size and spikiness:

ConditionAlgorithm
>100K points + spiky (>0.2)MinMax
>100K points + smoothAverage
Spikiness > 0.2MinMax
Spikiness > 0.1M4
Smooth dataLTTB

Default auto threshold: 1,000 points.

Usage in Queries

Downsampling is configured via query parameters:

# Auto downsampling to 500 points
curl "http://localhost:5555/v1/.../query?\
device_id=sensor-001&\
start_time=2026-01-01T00:00:00Z&\
end_time=2026-02-01T00:00:00Z&\
downsampling=auto&\
downsampling_threshold=500" \
-H "X-API-Key: your-api-key"

# Explicit LTTB downsampling
curl "http://localhost:5555/v1/.../query?\
downsampling=lttb&\
downsampling_threshold=1000" \
-H "X-API-Key: your-api-key"

Downsampling vs Aggregation

These are different concepts in Soltix:

FeatureAggregationDownsampling
WhenPre-computed on flushApplied at query time
WhereStorage serviceRouter post-processing
PurposeSpeed up time-range queriesReduce response size for visualization
LevelsFixed: 1h, 1d, 1M, 1yConfigurable threshold
Outputsum, avg, min, max, countOriginal or reduced data points