选择带有“小于”的查询要求在 InfluxDB 查询语言中不起作用

发布于 2025-01-14 02:46:32 字数 1371 浏览 5 评论 0原文

我将 influxdb 1.7.9-1 与一些数据库和一些测量一起使用。现在我想从带有字段过滤器和标签过滤器的测量中选择特定时间范围内的数据点。时间范围是从 2022-01-31T00:00:01.129322Z 到 2022-01-31T23:59:54.693945Z

SELECT "test_field" FROM "test_measurement" WHERE ("tag_1" = '165' AND "tag_2" = 'State' AND "tag_3" = 'I' AND time >= '2022-01-31T00:00:00.0Z')

此查询为我提供了 2022-01-31T00:00:01.129322Z 和2022-01-31T23:59:54.693945Z

现在我想要 2022-01-31T00:00:00.00Z 和 2022-01-31T01:00:00.0Z 之间的所有数据点

我这样尝试:

SELECT "test_field" FROM "test_measurement" WHERE ("tag_1" = '165' AND "tag_2" = 'State' AND "tag_3" = 'I' AND time >= '2022-01-31T00:00:00.0Z' AND time <= '2022-01-31T01:00:00.0Z')

但是这个查询不起作用。

有谁能告诉我为什么吗?

或者有没有其他方法从数据库中查询某个时间段?

2022 年 3 月 22 日更新: 我发现了一些有趣的事情。

我将 InfluxDB 与 Grafana 连接起来。 在下图中,您可以看到我的数据,时间范围为 2022-01-31 00:00:00 到 2022-02-22 00:00:00。此查询也适用于 CLI。

Grafana1

但后来我改变了一天的时间范围,突然我没有数据了。时间范围 2022-01-31 00:00:00 至 2022-02-22 00:00:00。 Grafana 没有给我任何查询,但我更改了之前查询的时间范围,但 CLI 中没有数据点。

Grafana2

我可以在 Grafana 或 InfluxDB 中更改任何设置,以便我可以在更近的时间范围内查看我的数据吗?

I use influxdb 1.7.9-1 with some databases and some measurements. Now i want to select datapoints in a specific time range from a measurement with filters for fields and one filter for a tag. The timerange is from 2022-01-31T00:00:01.129322Z to 2022-01-31T23:59:54.693945Z

SELECT "test_field" FROM "test_measurement" WHERE ("tag_1" = '165' AND "tag_2" = 'State' AND "tag_3" = 'I' AND time >= '2022-01-31T00:00:00.0Z')

This query is giving me all datapoints between 2022-01-31T00:00:01.129322Z and 2022-01-31T23:59:54.693945Z

Now I want all datapoints between 2022-01-31T00:00:00.00Z and 2022-01-31T01:00:00.0Z

I try it like this:

SELECT "test_field" FROM "test_measurement" WHERE ("tag_1" = '165' AND "tag_2" = 'State' AND "tag_3" = 'I' AND time >= '2022-01-31T00:00:00.0Z' AND time <= '2022-01-31T01:00:00.0Z')

But this query doesn't work.

Is anybody out there who can tell me why?

Or is there another way to query a certain period of time from a database?

UPDATE 2022-03-22:
I found something interesting.

I connected the InfluxDB with Grafana.
At the picture below you can see my data with Timerange 2022-01-31 00:00:00 to 2022-02-22 00:00:00. This query also works at the CLI.

Grafana1

But then i changed the time range for one day in an suddendly i have no data. Timerange 2022-01-31 00:00:00 to 2022-02-22 00:00:00. Grafana gives me no query, but i changed the time range from query before but there a no datapoints in the CLI.

Grafana2

Is there any setting which i can change in Grafana or InfluxDB that i can see my data in a closer timerange?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文