Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

TS.CREATE

Last updated
TS.CREATE key [RETENTION milliseconds] [LABELS label value [label value ...]]
Group
Time series
Complexity
O(L), L being the labels
Arity
-2 (at least 2 words, counting the command name)
Flags
write, slow
Keys
first 1, last 1, step 1
HotKV Cloud
Performance and Scale
On-Premise
requires the time-series license feature

TS.CREATE creates an empty time series named key. A time series holds samples (a millisecond timestamp and a floating-point value) in time order. Add samples with TS.ADD, read them with TS.RANGE and summarize them with TS.AGG.

Time series live beside the keyspace: KEYS, EXISTS and DEL do not see them, and a series name does not clash with a key of the same name. They are kept in snapshots. In cluster mode, a series lives on the node that owns the hash slot of its name.

Time series need the time-series license feature on HotKV On-Premise, and are included in the Performance and Scale plans on HotKV Cloud. Without it, every TS.* command replies NOLICENSE time-series requires a HotKV license. Contact sales@hotkv.com.

Option Effect
RETENTION milliseconds Drop samples older than this, measured back from the server’s current time. 0 (the default) keeps samples forever.
LABELS label value ... Attach label pairs, used to find series with TS.LIST.

Put RETENTION before LABELS when you use both.

The number of series a server holds is capped by the timeseries.max-series setting.

Case RESP2 RESP3
Created Simple string OK Simple string OK

Error replies:

  • ERR series already exists or limit reached
  • ERR invalid RETENTION value
  • ERR unknown option: name for an unknown option, or a label without a value.
  • NOLICENSE ... without the license feature.
127.0.0.1:6379> TS.CREATE temp:kitchen RETENTION 604800000 LABELS room kitchen
OK
127.0.0.1:6379> TS.CREATE temp:kitchen
(error) ERR series already exists or limit reached
127.0.0.1:6379> TS.CREATE temp:hall LABELS room
(error) ERR unknown option: room

HotKV’s own time series API. TS.CREATE shares its name with the RedisTimeSeries command, but takes only RETENTION and LABELS, and its error replies differ.

TS.ADD, TS.RANGE, TS.INFO, TS.RETENTION, TS.LIST, TS.DELETE