PostgresSQL use columns as a Tag

Hey,

I’ve a very basic plot which displays one series over time. Data gathered from Postgres.

image

When we hover over the series, grafana shows the value and the time. Now, all of these points has a different tag in some other column. Let’s say it’s “index: 1, index: 2” or “city: london, city: istanbul”.

I want to know, if I can display the information from other columns on hover. It’s something to plot or group by. I just want to display the information on hover as tags.


Secondly, I wonder if I could create a new series (with different colors), for each category in my selected tag column (e.g london and istanbul, 2 series) without aggregation over other columns.

For this example, I can create 2 separete queries with where clause for london and istanbul but is it possible to do in one query?

Can’t say more, because lack of information, such as the query, columns info, samples data and related informations…

@fadjar340

SELECT
date as "time" 
record_id,
distance
FROM my_table
ORDER BY "time"

I’m asking if I can show the record_id in hover without plotting it.