Skip to content



Generating range vectors from return values in Prometheus queries

Use the subquery-syntax

Warning: These subqueries are expensive, i.e. create very high load on Prometheus. Use recording-rules when you use these queries regularly.

Subquery syntax


  • instant_query: A PromQL-function which returns an instant-vector).
  • range: Offset (back in time) to start the first subquery.
  • resolution: The size of each of the subqueries.

It returns a range-vector.

For example:


In the example above, Prometheus runs rate() (= instant_query) 30 times (the first from 5 minutes ago to -4:50, ..., the last -0:10 to now). The resulting range-vector is input to the deriv() function.

Last update: 2022-11-25