diff --git a/app/vmselect/prometheus/prometheus.go b/app/vmselect/prometheus/prometheus.go index c388271919..4a9080ab55 100644 --- a/app/vmselect/prometheus/prometheus.go +++ b/app/vmselect/prometheus/prometheus.go @@ -554,7 +554,9 @@ func QueryHandler(at *auth.Token, w http.ResponseWriter, r *http.Request) error if len(query) > *maxQueryLen { return fmt.Errorf(`too long query; got %d bytes; mustn't exceed %d bytes`, len(query), *maxQueryLen) } - if ct-start < queryOffset { + if !getBool(r, "nocache") && ct-start < queryOffset { + // Adjust start time only if `nocache` arg isn't set. + // See https://github.com/VictoriaMetrics/VictoriaMetrics/issues/241 start = ct - queryOffset } if childQuery, windowStr, offsetStr := promql.IsMetricSelectorWithRollup(query); childQuery != "" {