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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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 <[email protected]>
@aknuds1 aknuds1 force-pushed the arve/inverse-postings-for-matcher branch from c065c55 to f319404 Compare November 19, 2024 16:08
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.

1 participant