Influx - get all unique timestamps

Hello,
i have an influxdb measurement like this:

time field1 field2
2022-05-10T10:15:16.789Z 12 22
2022-05-10T10:15:16.789Z 12 12
2022-05-11T10:15:16.789Z 14 22
2022-05-11T10:15:16.789Z 14 25
2022-05-12T10:15:16.789Z 12 22
2022-05-12T10:15:16.789Z 13 21

I would like to show these values in a grafana table and want to show the fields filtered by time.
So i need to create avariable that has unique timestamps.

Can you help me with this query? Or is this not possible?

In the table-view i will then create a query like select * from measurement where time=$selected_time

Hey @fuba122,

So, if I understood correctly, you are trying to filter the measurements so it will only appear one per unique timestamp depending on the filtering value, right?

To be honest, I think that you should add some tags as metadata that will allow you to filter this data:

time field1 field2 tag
2022-05-10T10:15:16.789Z 12 22 1
2022-05-10T10:15:16.789Z 12 12 2
2022-05-11T10:15:16.789Z 14 22 3
2022-05-11T10:15:16.789Z 14 25 4
2022-05-12T10:15:16.789Z 12 22 5
2022-05-12T10:15:16.789Z 13 21 6

This way, if you filter by the tag (which is actually more performant) you will only get 1 measurement per timestamp.

Let me know if this is what you were looking for.

hello, thanks for your answer. Yes that is exactly what i need. So a filter by time is not possible? Onlay via extra tag?

Help me here because maybe I am missing something.

If you are trying to show only one record per timestamp, but some of them share the same timestamp, how are you planning to distinguish them only by using time?

As I see it, you will need a column with distinct values in order to filter, the problem with the field columns is that the value varies a lot and is less performant than tags. That’s why I see tags as the best solution for your problem.

understood your answer. Just wanted to know, if this is technically possible.

With one timestamp there are multiple entries in the measurement. So while writing data to the influxdb the timestamp was set manually.

As a result i would like to create a tableview with only the data feom one selected timestamp.

So if this is only possible wit an additional tag, then i need to adapt my script.

Hello @fuba122
What version of InfluxDB are you using?

Hello i am using version 1.8.0