Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PERF] TSDB: Optimize inverse matching (#14144) #756

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

aknuds1
Copy link
Contributor

@aknuds1 aknuds1 commented Nov 19, 2024

Cherry-pick prometheus/prometheus#14144, a querying performance improvement (see upstream PR for benchmark stats).

@aknuds1 aknuds1 force-pushed the arve/inverse-postings-for-matcher branch from 8406d7b to c065c55 Compare November 19, 2024 16:05
@aknuds1 aknuds1 requested a review from colega November 19, 2024 16:06
@aknuds1 aknuds1 added the enhancement New feature or request label Nov 19, 2024
Simple follow-up to #13620. Modify `tsdb.PostingsForMatchers` to use the optimized tsdb.IndexReader.PostingsForLabelMatching method also for inverse matching.

Introduce method `PostingsForAllLabelValues`, to avoid changing the existing method.

The performance is much improved for a subset of the cases; there are up to
~60% CPU gains and ~12.5% reduction in memory usage.

Remove `TestReader_InversePostingsForMatcherHonorsContextCancel` since
`inversePostingsForMatcher` only passes `ctx` to `IndexReader` implementations now.

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
@aknuds1 aknuds1 force-pushed the arve/inverse-postings-for-matcher branch from c065c55 to f319404 Compare November 19, 2024 16:08
@aknuds1 aknuds1 merged commit 0b99fcf into main Nov 20, 2024
9 checks passed
@aknuds1 aknuds1 deleted the arve/inverse-postings-for-matcher branch November 20, 2024 08:25
colega added a commit to grafana/mimir that referenced this pull request Nov 29, 2024
colega added a commit to grafana/mimir that referenced this pull request Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants