TSGET
AttentionThis page documents an earlier version. Go to the latest (v2.1)version.
Synopsis
TSGET key timestamp
This command fetches the value for the given timestamp
in the time series that is specified by thegiven key
.
- If the given
key
ortimestamp
does not exist, nil is returned. - If the given
key
is associated with non-timeseries data, an error is raised. - If the given
timestamp
is not a valid signed 64 bit integer, an error is raised.
Return Value
Returns the value for the given timestamp
Examples
The timestamp can be arbitrary integers used just for sorting values in a certain order.
$ TSADD cpu_usage 10 "70"
"OK"
$ TSADD cpu_usage 20 "80" 30 "60" 40 "90"
"OK"
We could also encode the timestamp as “yyyymmddhhmm”, since this would still produce integers that are sortable by the actual timestamp.
$ TSADD cpu_usage 201710311100 "50"
"OK"
A more common option would be to specify the timestamp as the unix timestamp.
$ TSADD cpu_usage 1509474505 "75"
"OK"
$ TSGET cpu_usage 10
"70"
$ TSGET cpu_usage 100
(nil)
$ TSGET cpu_usage 201710311100
"50"
$ TSGET cpu_usage 1509474505
"75"
An error is returned when the timestamp is not an int64.
$ TSGET cpu_usage xyz
(error) Request was unable to be processed from server.
See Also
tsadd
, tsrem
, tsrangebytime
,tsrevrangebytime
, tslastn
, tscard
当前内容版权归 YugabyteDB 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 YugabyteDB .