【问题标题】:Influxdb: Query to create a list from some valuesInfluxdb:查询以从某些值创建列表
【发布时间】:2017-11-26 01:59:46
【问题描述】:

在 InfluxDB 中,如何使用“SELECT”语句或任何其他“查询”创建字符串/值列表?

我的问题和这个问题一样:mysql fake select
但是,对于Influxdb

我正在使用最新版本的 InfluxDB,即 1.2.4

【问题讨论】:

  • 你使用的是哪个influxdb版本?
  • @tom 最新版本,即 1.2.4

标签: sql select influxdb dummy-data


【解决方案1】:

目前,influxdb 中没有 IN 运算符支持。

假设我想像这样运行查询 -

 select value from measurement where key in ('903','965' ,'890') group by key limit 10 offset 0;

这可以通过这样的方式完成 -

 select value from measurement where key='903' or key='965' or key='890' group by key limit 10 offset 0;

正则表达式

 select value from measurement where key=~ /^903$|^965$|^890$/ group by key limit 10 offset 0;

但是,上面的方式是未索引的,所以一旦 influxdb 开始支持IN operator,我会更新我的答案。

让我知道,如果这种方法不适合你,我会尝试更新它。

【讨论】:

  • 这是我最初寻找的,它作为 'like' 运算符工作,但在添加 ^ $ 后给出了正确的结果。
猜你喜欢
  • 1970-01-01
  • 2021-09-06
  • 2022-08-14
  • 1970-01-01
  • 1970-01-01
  • 2018-10-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多