@@ -62,17 +62,16 @@ TSDB-TYPE
6262 .
6363```
6464
65- The timestamp for each data point is a 64-bit integer value. This is designed
66- to support Unix timestamps, measured in milliseconds since the
67- [ Unix epoch] ( https://en.wikipedia.org/wiki/Unix_time ) . However, you can interpret
68- the timestamps in any way you like (for example, as the number of days since a given start date).
65+ The timestamp for each data point is a 64-bit integer value. The value
66+ represents a Unix timestamp, measured in milliseconds since the
67+ [ Unix epoch] ( https://en.wikipedia.org/wiki/Unix_time ) .
6968When you create a time series, you can specify a maximum retention period for the
7069data, relative to the last reported timestamp. A retention period of zero means
7170the data does not expire.
7271
7372``` bash
7473# Create a new time series with a first value of 10.8 (Celsius),
75- # recorded on day 1, with a retention period of 100 days .
74+ # recorded at time 1, with a retention period of 100ms .
7675> TS.ADD thermometer:2 1 10.8 RETENTION 100
7776(integer) 1
7877> TS.INFO thermometer:2
@@ -85,8 +84,8 @@ the data does not expire.
8584```
8685
8786You can also add one or more * labels* to a time series when you create it. Labels
88- are key -value pairs where the value can be a string or a number . You can use
89- both the keys and values to select subsets of all the available time series
87+ are name -value pairs where both the name and value are strings . You can use
88+ the names and values to select subsets of all the available time series
9089for queries and aggregations.
9190
9291``` bash
@@ -127,12 +126,12 @@ Unix time, as reported by the server's clock.
127126
128127## Query data points
129128
130- Use [ ` TS.GET ` ] ({{< relref "commands/ts.get/" >}}) to retrieve the last data point
131- added to a time series. This returns both the timestamp and the value.
129+ Use [ ` TS.GET ` ] ({{< relref "commands/ts.get/" >}}) to retrieve the data point
130+ with the highest timestamp in a time series. This returns both the timestamp and the value.
132131
133132``` bash
134133# The last recorded temperature for thermometer:2
135- # was 10.3 on day 2 .
134+ # was 10.3 at time 2ms .
136135> TS.GET thermometer:2
1371361) (integer) 2
1381372) 10.3
@@ -147,7 +146,7 @@ an array of timestamp-value pairs returned in ascending order by timestamp.
147146If you want the results in descending order, use [ ` TS.REVRANGE ` ] ({{< relref "commands/ts.revrange/" >}}) with the same parameters.
148147
149148``` bash
150- # Add 5 data points to a rain gauge time series.
149+ # Add 5 data points to a time series named "rg:1" .
151150> TS.CREATE rg:1
152151OK
153152> TS.MADD rg:1 0 18 rg:1 1 14 rg:1 2 22 rg:1 3 18 rg:1 4 24
1701695) 1) (integer) 4
171170 2) 24
172171
173- # Retrieve data points up to day 1 (inclusive).
172+ # Retrieve data points up to time 1 (inclusive).
174173> TS.RANGE rg:1 - 1
1751741) 1) (integer) 0
176175 2) 18
1771762) 1) (integer) 1
178177 2) 14
179178
180- # Retrieve data points from day 3 onwards.
179+ # Retrieve data points from time 3 onwards.
181180> TS.RANGE rg:1 3 +
1821811) 1) (integer) 3
183182 2) 18
1971965) 1) (integer) 0
198197 2) 18
199198
200- # Retrieve data points up to day 1 (inclusive), but
199+ # Retrieve data points up to time 1 (inclusive), but
201200# return them in descending order.
202201> TS.REVRANGE rg:1 - 1
2032021) 1) (integer) 1
@@ -254,7 +253,7 @@ for details of the filter syntax. You can also request that
254253data points be returned with all their labels or with a selected subset of them.
255254
256255``` bash
257- # Create three new rain gauge time series, two in the US
256+ # Create three new "rg: time series, two in the US
258257# and one in the UK, with different units and add some
259258# data points.
260259> TS.CREATE rg:2 LABELS location us unit cm
2842832) (integer) 4
2852843) (integer) 4
286285
287- # Retrieve the last data point from each US rain gauge . If
286+ # Retrieve the last data point from each US time series . If
288287# you don't specify any labels, an empty array is returned
289288# for the labels.
290289> TS.MGET FILTER location=us
311310 3) 1) (integer) 4
312311 2) 7.4E-1
313312
314- # Retrieve data points up to day 2 (inclusive) from all
315- # rain gauges that report in millimeters. Include all
313+ # Retrieve data points up to time 2 (inclusive) from all
314+ # time series that use millimeters as the unit . Include all
316315# labels in the results.
317316> TS.MRANGE - 2 WITHLABELS FILTER unit=mm
3183171) 1) " rg:4"
327326 3) 1) (integer) 2
328327 2) 21
329328
330- # Retrieve data points from day 1 to day 3 (inclusive) from
331- # all rain gauges that report in centimeters or millimeters,
329+ # Retrieve data points from time 1 to time 3 (inclusive) from
330+ # all time series that use centimeters or millimeters as the unit ,
332331# but only return the `location` label. Return the results
333332# in descending order of timestamp.
334333> TS.MREVRANGE 1 3 SELECTED_LABELS location FILTER unit=(cm,mm)
4894883) (integer) 3
4904894) (integer) 3
491490
492- # The result pairs contain the timestamp and the maximum wind speed
491+ # The result pairs contain the timestamp and the maximum sample value
493492# for the country at that timestamp.
494493> TS.MRANGE - + FILTER country=(us,uk) GROUPBY country REDUCE max
4954941) 1) " country=uk"
509508 3) 1) (integer) 3
510509 2) 18
511510
512- # The result pairs contain the timestamp and the average wind speed
511+ # The result pairs contain the timestamp and the average sample value
513512# for the country at that timestamp.
514513> TS.MRANGE - + FILTER country=(us,uk) GROUPBY country REDUCE avg
5155141) 1) " country=uk"
@@ -547,9 +546,8 @@ aggregation function, and the bucket duration. Note that the destination time
547546series must already exist when you create the rule and also that the compaction will
548547only process data that is added to the source series after you create the rule.
549548
550- For example, you could use the commands below to create a time series for
551- [ hygrometer] ( https://en.wikipedia.org/wiki/Hygrometer ) readings along with a compaction
552- rule to find the minimum reading in each three day period.
549+ For example, you could use the commands below to create a time series along with a
550+ compaction rule to find the minimum reading in each period of 3ms.
553551
554552``` bash
555553# The source time series.
0 commit comments