Interview Prep/Monitoring & Observability/PromQL and recording rules

Subquery `max_over_time(rate(x[5m])[1d:])` is extremely slow

AdvancedTroubleshootingPromQL and recording rules
Answer

Likely causes → Without an explicit resolution, the subquery uses the global evaluation interval, computing rate at thousands of points per series.

Diagnose → Check query time in the Prometheus UI stats and the series count.

Fix → Set resolution [1d:5m], or better, create a recording rule for rate(x[5m]) and run max_over_time over that.

Prevent → Ban raw subqueries in alerts; use recording rules.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on PromQL and recording rules