InfluxDB-仅获取查询中的最后一个值 [英] InfluxDB - Getting only last value in query
问题描述
是否可以仅查询查询结果的最后一个值(或第n个值)?
Is possible to query only for the last value (or n-th value) of the results of a query?
例如,在查询中:
SELECT value FROM response_times WHERE time > now() - 1h limit 1000;
是否只能获取最后一个值,即时间上更远的那个值(可能是第1000个元素)?
Is possible to get only the last value, i.e. the one more far ago in time (possibly the 1000-th element)?
我当然可以全部检索它们,然后跳到最后一个,但是我不想这样浪费带宽.
Of course I can retrieve them all and then skip to the last one, but I don't want to waste bandwith this way.
推荐答案
在API中,查看first/last以选择列的第一条或最后一条记录. 您还可以从顶部/底部选择多个记录
In the API, have a look at first/last to select the first or last record of a column. You also have top/bottom to select more than one record
[edit]顶部/底部似乎返回了时间范围内的最高/最低值
[edit] top/bottom seem to return higest/lowest values of the time frame
这篇关于InfluxDB-仅获取查询中的最后一个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!