TS.ALTER
- Available in:
- Redis Stack / Time series 1.0.0
- Time complexity:
- O(N) where N is the number of labels requested to update
Update the retention, chunk size, duplicate policy, and labels of an existing time series
Syntax
TS.ALTER key
[RETENTION retentionPeriod]
[CHUNK_SIZE size]
[DUPLICATE_POLICY policy]
[LABELS [{label value}...]]Required arguments
key
is key name for the time series.
RETENTION and LABELS, the chunk size and the duplicate policy are not altered.
Optional arguments
RETENTION retentionPeriod
is maximum retention period, compared to the maximum existing timestamp, in milliseconds. See RETENTION in TS.CREATE.
CHUNK_SIZE size
is the initial allocation size, in bytes, for the data part of each new chunk. Actual chunks may consume more memory. See CHUNK_SIZE in TS.CREATE. Changing this value does not affect existing chunks.
DUPLICATE_POLICY policy
is policy for handling multiple samples with identical timestamps. See DUPLICATE_POLICY in TS.CREATE.
LABELS [{label value}...]
is set of label-value pairs that represent metadata labels of the key and serve as a secondary index.
If LABELS is specified, the given label list is applied. Labels that are not present in the given list are removed implicitly. Specifying LABELS with no label-value pairs removes all existing labels. See LABELS in TS.CREATE.
Examples
Alter a temperature time series
Create a temperature time series.
127.0.0.1:6379> TS.CREATE temperature:2:32 RETENTION 60000 DUPLICATE_POLICY MAX LABELS sensor_id 2 area_id 32
OKAlter the labels in the time series.
127.0.0.1:6379> TS.ALTER temperature:2:32 LABELS sensor_id 2 area_id 32 sub_area_id 15
OKSee also
Related topics
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.