Available in: Redis Stack
Time complexity: O(1)
Create a compaction rule.
TS.CREATERULE sourceKey destKey AGGREGATION aggregator bucketDuration [alignTimestamp]
sourceKey - Key name for source time series
destKey - Key name for destination (compacted) time series
AGGREGATION aggregator bucketDuration
Aggregate results into time buckets.
|arithmetic mean of all values|
|sum of all values|
|difference between the highest and the lowest value|
|number of values|
|the value with the lowest timestamp in the bucket|
|the value with the highest timestamp in the bucket|
|population standard deviation of the values|
|sample standard deviation of the values|
|population variance of the values|
|sample variance of the values|
|time-weighted average of all values|
The alignment of time buckets is 0.
destKey should be of a
timeseries type, and should be created before
TS.CREATERULE is called.
TS.CREATERULEwith a nonempty destKey can result in an undefined behavior