I’d like to know if it’s possible and how to render multiple timeseries defining one column of the result set as a pivot column. For some queries I don’t know in advance how many series I’m getting hence is not possible to create a multi column query. At the moment I’m using tablefunc in postgresql but it’s very annoying solution indeed we need to know the columns name in advance
Result set is in this form:
t, series_name, value
0.0, s1, 12
0.0, s2, 13
1.0, s1, 14
1.0, s2, 12
it would be very good if we could define the column series_name as the pivot column and have grafana automatically plots two series, one per s1 lines and one per s2 lines
i think that what you want is already, can you post one of your queries?
SELECT t, series_name, value
WHERE t>now()-‘5 days’::interval;
Mmm sorry i dont understan to you… can you explain a little better?
Grafana is able to produce graphs out of a single query with result set such as rows of times and value, in order to have another graph we can add a second query on the same graph like:
q1) SELECT time, value FROM test WHERE series_name = ‘A’;
q2) SELECT time, value FROM test WHERE series_name = ‘B’;
the issue is that in some cases we don’t know in advance the name of series and most of all how many series we have, the ideal would be to do:
SELECT time, series_name, value FROM test;
and then tell Graphan that series_name is the column it has to use for pivoting the values producing out of it multiple lines.
You can do that!!