InfluxDB-仅获取查询中的最后一个值 [英] InfluxDB - Getting only last value in query

查看:2391
本文介绍了InfluxDB-仅获取查询中的最后一个值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以仅查询查询结果的最后一个值(或第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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆