diff --git a/app/vmselect/promql/aggr_incremental.go b/app/vmselect/promql/aggr_incremental.go index 581b3a8f5..26f91ed0e 100644 --- a/app/vmselect/promql/aggr_incremental.go +++ b/app/vmselect/promql/aggr_incremental.go @@ -5,6 +5,7 @@ import ( "strings" "sync" + "github.com/VictoriaMetrics/VictoriaMetrics/lib/bytesutil" "github.com/VictoriaMetrics/metricsql" ) @@ -98,7 +99,8 @@ func (iafc *incrementalAggrFuncContext) updateTimeseries(tsOrig *timeseries, wor removeGroupTags(&ts.MetricName, &iafc.ae.Modifier) bb := bbPool.Get() bb.B = marshalMetricNameSorted(bb.B[:0], &ts.MetricName) - iac := m[string(bb.B)] + k := bytesutil.InternBytes(bb.B) + iac := m[k] if iac == nil { if iafc.ae.Limit > 0 && len(m) >= iafc.ae.Limit { // Skip this time series, since the limit on the number of output time series has been already reached. @@ -117,7 +119,7 @@ func (iafc *incrementalAggrFuncContext) updateTimeseries(tsOrig *timeseries, wor ts: tsAggr, values: make([]float64, len(ts.Values)), } - m[string(bb.B)] = iac + m[k] = iac } bbPool.Put(bb) iafc.callbacks.updateAggrFunc(iac, ts.Values)