Influxdb query duration

Hi, I want to calculate how long each query take? Can you check out the query below. I thought, we should divide the cumulative duration by how many queries executed or finished. Am I doing right?

SELECT non_negative_derivative(mean("queryDurationNs"), 10s) / non_negative_derivative(mean("queriesFinished"), 10s) AS "query duration" FROM "influxdb_queryExecutor" WHERE $timeFilter GROUP BY time(1m) fill(null)

Hello @Mert,
Perhaps this thread is useful to you?

Thank you

Thanks @Anaisdg,

I don’t think these are closely related topics. influxdb already exposes some metrics which includes “queryDurationNs”. I just wanted to know if my query is logically correct. I think, in order to get “a query duration” we need to divide the “query duration” by the “number of queries executed”.