redisredistimeseries

Redis Timeseries - Representing the numberic value as a list of values


I'm new to Redis Timeseries and I'd like to know if it is possible to add data to a TS as a list of values instead of a single numeric value.

Here my specific example about representing trading candles:

# Creating a TS for open and close values
TS.CREATE BTCUSD1H_OPEN
TS.CREATE BTCUSD1H_CLOSE
# adding values for each one of them at the same timestamp
TS.ADD BTCUSD1H_OPEN 1652824475581 21.000
TS.ADD BTCUSD1H_CLOSE 1652824475581 20.000

Everything is correct and working fine, but I'm asking myself: is there a way in Redis to use a single TS with a list of values for each timestamp?

In the above example it would be something like:

# Just ONE timeseries, for BOTH open and close values
TS.CREATE BTCUSD1H
# adding values as list (first one is "open", second one is "close")
TS.ADD BTCUSD1H 1652824475581 21.000, 20.000

Of course, this last example doesn't work because it violates the Redis syntax.

From the documentation it seems to be not possible, but I'm asking here maybe there is a workaround.


Solution

  • No. RedisTimeSeries is currently (v1.X) a single-column time series database, which means that a time series is a set of (timestamp, value) pairs. You are asking about multi-column (or multi-metric) capability.

    Nevertheless, by creating multiple time series you are not loosing any capabilities. You gain simplicity and also better flexibility for handling missing values. Due to the efficient compression, the extra memory required is minimal, and using labels as secondary indexes you can easily query data from multiple time series.