TSRANGEBYTIME

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

TSRANGEBYTIME key low_ts high_tsThis command fetches the values for the given low_ts, high_ts range in the time series that isspecified by the given key.

  • If the given key is associated with non-timeseries data, an error is raised.
  • If the given low_ts or high_ts are not a valid signed 64 bit integers, an error is raised.
  • low_ts and high_ts are inclusive unless they are prefixed with (, in that case they areexclusive.
  • Special bounds -inf and +inf are also supported to retrieve an entire range

Return Value

Returns a list of timestamp, value pairs found in the range specified by low_ts, high_ts

Examples

You can do this as shown below.

  1. TSADD ts 1 one 2 two 3 three 4 four 5 five 6 six
  1. "OK"
  1. TSRANGEBYTIME ts_key 2 4
  1. 1) "2"
  2. 2) "two"
  3. 3) "3"
  4. 4) "three"
  5. 5) "4"
  6. 6) "four"

2 is exclusive

  1. TSRANGEBYTIME ts_key (2 4
  1. 1) "3"
  2. 2) "three"
  3. 3) "4"
  4. 4) "four"

2 and 4 are exclusive

  1. TSRANGEBYTIME ts_key (2 (4
  1. 1) "3"
  2. 2) "three"
  1. TSRANGEBYTIME ts_key -inf 3
  1. 1) "1"
  2. 2) "one"
  3. 3) "2"
  4. 4) "two"
  5. 5) "3"
  6. 6) "three"
  1. TSRANGEBYTIME ts_key 2 +inf
  1. 1) "2"
  2. 2) "two"
  3. 3) "3"
  4. 4) "three"
  5. 5) "4"
  6. 6) "four"
  7. 7) "5"
  8. 8) "five"
  9. 9) "6"
  10. 10) "six"

See Also

tsrevrangebytime, tsadd, tsget,tsrem, tslastn, tscard