I am using Grafana 6.4 and InfluxDB 1.7 as datasource.
For monitoring purpose, I store tons of KPIs of Oracle databases in the Influxdb database.
One of theses KPI are the number of executions of Oracle SQL statements.
I would like to graph in a Panel the top N of the most executed SQL queries.
I tried this query in a Panel:
SELECT TOP(“sum_executions_delta”, SQL_ID,5)
SELECT sum(“executions_delta”) as “sum_executions_delta” FROM “SQLSTATS”
WHERE (“DBID” =~ /^DBID/) AND $timeFilter GROUP BY time($interval), “DBID”, “SQL_ID” fill(null)
where $timeFilter GROUP BY time($interval)
The “Table” visualization gives the correct results :
When I use the “Graph” visualization, the result is not as expected since there is no series per SQL id :
=>Since all points belong to the same serie, it is unusable. I cannot identify any SQL id on the graph.
So my first question is: How to graph a “top n” with n series ( ie 1 serie per SQL id ) ?
I also tried to create a variable that represents the “top n” sql id.
=> Is there a way to use $timefilter in the query of the variable ?
Thanks in advance for your help.