Smart buildings
Temperature, CO2 and occupancy are stored per floor, with raw data for a day and hourly averages for reports.
Ingest sensor and metrics samples, keep raw data for as long as you need, copy it to long-retention series, and aggregate into buckets on demand.
Keep raw samples for 24 hours and label them by building and type.
An animated walkthrough with real HotKV commands and example replies. Click any step to jump to it.
Thousands of sensors each send a reading every few seconds. Raw data is needed for a few hours for alerting, a year of history for reports, and finding the right series means searching by building, floor or device type. Running a separate time series database for that is one more system to operate.
Time series in HotKV have a retention period and labels. Devices append samples with TS.ADD, a downsampling rule copies every new sample into a series you keep longer, and TS.AGG aggregates any range into fixed-width buckets with avg, min, max and other functions.
Keep raw samples for 24 hours and label them by building and type.
TS.CREATE temp:b4:f2 RETENTION 86400000 LABELS building b4 type temperatureA second series that keeps samples for a year.
TS.CREATE temp:b4:f2:1y RETENTION 31536000000Every new sample is also copied to the long-term series. Read it as hourly averages with TS.AGG.
TS.DOWNSAMPLE temp:b4:f2 temp:b4:f2:1y avg 3600000Sensors report through the gateway. * uses the server's time.
TS.ADD temp:b4:f2 * 21.4Five-minute averages for the last hour, ready to plot.
TS.AGG temp:b4:f2 1790982000000 1790985600000 300000 avgEvery temperature series in building b4.
TS.LIST LABEL building b4Temperature, CO2 and occupancy are stored per floor, with raw data for a day and hourly averages for reports.
Vehicle speed, battery and engine data are ingested continuously and charted per vehicle.
Request latency and error counts per endpoint feed live dashboards without a separate metrics database.
Old samples are removed automatically.
TS.CREATETS.RETENTIONNew samples are copied to a long-retention series, which you aggregate when you read.
TS.DOWNSAMPLEAggregate any range into fixed-width buckets.
TS.AGGTS.RANGEFind series by label value.
TS.LISTTS.INFOYes. Pass a Unix time in milliseconds instead of * to TS.ADD.
See the TS.AGG reference for the full list, including avg, min, max and sum.
Time series are part of the Performance and Scale plans.
HotKV speaks the Redis protocol, so you can point an existing client at it and run these same commands.