What is a subquery?

AdvancedConceptPromQL & Recording Rules
Answer

A subquery evaluates an instant query at a resolution over a range, producing a range vector you can feed to _over_time functions:

max_over_time(rate(http_requests_total[5m])[1h:1m])

This means "the highest 5-minute rate in the last hour, sampled every minute". Subqueries are expensive on large data; if you use one regularly, write the inner expression as a recording rule and apply max_over_time to that.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL & Recording Rules