Skip to content

Query for "last timestamp" takes very long #339

@MatinF

Description

@MatinF

I'm trying to run below query to fetch the last timestamp of a specific measurement (an IoT device) across the various fields (parameters). My query looks as below via the Python API:

influx_time = self.client.query_api().query(
                    f'from(bucket:"{self.influx_bucket}") |> range(start: 0, stop: now()) |> filter(fn: (r) => r["_measurement"] == "{device}") |> keep(columns: ["_time"]) |> sort(columns: ["_time"], desc: false) |> last(column: "_time")'
                )

My question is whether there is an issue/bug with this query or the InfluxDB Python API? It seems to take ~76 seconds for a very light process. Any inputs are welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions