From 0d47c23a0348e16f1a2c62a0952f76f4411ef425 Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@victoriametrics.com>
Date: Thu, 24 Feb 2022 04:03:25 +0200
Subject: [PATCH] app/vmselect/promql: reduce the maximum number of label
 values, which can be propagated from one side of the binary operation to
 another side of the binary operation from 10K to 1K

There are user reports that 10K unique values in a single label filter may lead to performance and memory usage issues
---
 app/vmselect/promql/eval.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/vmselect/promql/eval.go b/app/vmselect/promql/eval.go
index 535bd1dabe..0a88756a58 100644
--- a/app/vmselect/promql/eval.go
+++ b/app/vmselect/promql/eval.go
@@ -382,7 +382,7 @@ func getCommonLabelFilters(tss []*timeseries) []metricsql.LabelFilter {
 			continue
 		}
 		values = getUniqueValues(values)
-		if len(values) > 10000 {
+		if len(values) > 1000 {
 			// Skip the filter on the given tag, since it needs to enumerate too many unique values.
 			// This may slow down the search for matching time series.
 			continue