mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
I was surprised to find out that posting lookups for `foo=~"(bar|bar)"` are faster than `foo=~"bar"`. It turns out we introduced a performance regression in https://github.com/grafana/mimir-prometheus/pull/463. When we added the `optimizeAlternatingLiterals` function, we subtly broke one edge case. A regexp matcher which matches a single literal, like `foo=~"bar"` used to return `bar` from `SetMatches()`, but currently does not. The implication is that the tsdb will first do a LabelValues call to get all values for `foo`, then match them against the regexp `bar`. This PR restores the previous behavior which is able to directly lookup postings for `foo="bar"` instead. |
||
---|---|---|
.. | ||
labels.go | ||
labels_common.go | ||
labels_stringlabels.go | ||
labels_test.go | ||
matcher.go | ||
matcher_test.go | ||
regexp.go | ||
regexp_test.go | ||
sharding.go | ||
sharding_stringlabels.go | ||
sharding_test.go | ||
test_utils.go |