[Avg. reading time: 5 minutes]

Timeseries

RedisTimeSeries is a Redis module that enhances Redis with capabilities to efficiently store and analyze time series data. It's designed to handle time-based data for use cases such as monitoring, IoT, financial data analysis, etc. Below are some key features of RedisTimeSeries:

Key Features

Efficient Data Storage: Optimized for appending time series data with a low storage footprint.

Automatic Compaction: Supports configurable compaction policies (downsampling) to save space.

Time-Series Aggregation: Built-in functions for aggregation (like AVG, SUM, MIN, MAX).

Label-Based Queries: Similar to tags, labels allow you to query sets of time series using metadata.

Retention Policies: You can set a retention period for data to manage memory usage automatically.

High Throughput: Handles millions of inserts per second, making it a good fit for high-frequency data.

Data Compression: Efficiently compresses time series data for reduced memory usage.

What is Epoch Time?

Epoch Converter

TS.CREATE temperature:room1 RETENTION 60000 LABELS location room1 unit celsius
  • 60000 milli seconds
type temperature:room1
DEL temperature:room1

ADD Data to Time Series

TS.ADD temperature:room1 * 22.5
    • meaning use the system time.

Add few more

TS.ADD temperature:room1 * 21.5

TS.ADD temperature:room1 * 21.45

TS.ADD temperature:room1 * 22.52

Get the values between EPOCH TS

TS.RANGE temperature:room1 1728503705075 1728503757000
  • No you cannot use Human Date time

Aggregation

TS.RANGE temperature:room1 0 + INF AGGREGATION avg 60000

By default Upsert not supported

TS.MADD temperature:room1 1728503756138 23.5 temperature:room1 1728503756139 24.0 temperature:room1 1728503756133 21.8

Get values between earliest TS to latest TS for given range

TS.RANGE temperature:room1 - + FILTER_BY_VALUE 21.5 23.5

GET earliest TS only

TS.RANGE temperature:room1 - + COUNT 1

#TSDB #TimeSeries #NoSQL #RedisVer 5.5.3

Last change: 2025-10-15