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

Regex set optimization when querying for chunks in index #2446

Merged
merged 7 commits into from
Apr 15, 2020
Merged

Regex set optimization when querying for chunks in index #2446

merged 7 commits into from
Apr 15, 2020

Conversation

pstibrany
Copy link
Contributor

@pstibrany pstibrany commented Apr 10, 2020

This PR implements "regex set" optimization when querying chunks in index. If label matcher is in form label=~"a|b", then we can simply query index for label=a, label=b. This reduces number of fetched chunk IDs and matching we need to do in memory. (This is similar optimization to what Prometheus has in TSDB layer)

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

/cc @codesome

@pstibrany pstibrany changed the title Regex set optimization Regex set optimization when fetching chunks Apr 10, 2020
@pstibrany pstibrany changed the title Regex set optimization when fetching chunks Regex set optimization when querying for chunks in index Apr 10, 2020
Copy link
Contributor

@gouthamve gouthamve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @pstibrany! There is conflict but other than that, I think this ready to go!

…kIdsByMetricNameMatcher.

Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Signed-off-by: Peter Štibraný <peter.stibrany@grafana.com>
Copy link
Contributor

@pracucci pracucci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good job @pstibrany! LGTM 👏

@pstibrany
Copy link
Contributor Author

Thanks for reviews!

@pstibrany pstibrany merged commit 9051641 into cortexproject:master Apr 15, 2020
@pstibrany pstibrany deleted the regex-set-optimization branch April 15, 2020 09:29
gouthamve added a commit to gouthamve/cortex that referenced this pull request Apr 16, 2020
Similar to cortexproject#2446

Super useful for templated grafana dashboards which send matchers such
as =~"a|b|c|d|"

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
gouthamve added a commit that referenced this pull request Apr 17, 2020
* Regex set optimisation when looking series in ingester

Similar to #2446

Super useful for templated grafana dashboards which send matchers such
as =~"a|b|c|d|e"

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Add CHANGELOG entry

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Add benchmark for set optimisation

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
cyriltovena pushed a commit to cyriltovena/loki that referenced this pull request Jun 11, 2021
* Regex set optimisation when looking series in ingester

Similar to cortexproject/cortex#2446

Super useful for templated grafana dashboards which send matchers such
as =~"a|b|c|d|e"

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Add CHANGELOG entry

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>

* Add benchmark for set optimisation

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants