TS.DEL

Syntax
TS.DEL key fromTimestamp toTimestamp
Available in:
Redis Stack / Time series 1.6.0
Time complexity:
O(N) where N is the number of data points that will be removed

Delete all samples between two timestamps for a given time series

Examples

Required arguments

key

is key name for the time series.

fromTimestamp

is start timestamp for the range deletion.

toTimestamp

is end timestamp for the range deletion.

The given timestamp interval is closed (inclusive), meaning that samples whose timestamp eqauls the fromTimestamp or toTimestamp are also deleted.

Return value

Integer reply: The number of samples that were removed.

Examples

Delete range of data points

Create time series for temperature in Tel Aviv and Jerusalem, then add different temperature samples.

127.0.0.1:6379> TS.CREATE temp:TLV LABELS type temp location TLV
OK
127.0.0.1:6379> TS.CREATE temp:JLM LABELS type temp location JLM
OK
127.0.0.1:6379> TS.MADD temp:TLV 1000 30 temp:TLV 1010 35 temp:TLV 1020 9999 temp:TLV 1030 40
1) (integer) 1000
2) (integer) 1010
3) (integer) 1020
4) (integer) 1030
127.0.0.1:6379> TS.MADD temp:JLM 1005 30 temp:JLM 1015 35 temp:JLM 1025 9999 temp:JLM 1035 40
1) (integer) 1005
2) (integer) 1015
3) (integer) 1025
4) (integer) 1035

Delete the range of data points for temperature in Tel Aviv.

127.0.0.1:6379> TS.DEL temp:TLV 1000 1030
(integer) 4

See also

TS.ADD

RedisTimeSeries

Feedback

If you've found issues on this page, or have suggestions for improvement, please submit a request to merge or open an issue in the repository.