Skip to content

expose SelectorBatchSize config for Thanos engine - #7763

Merged
yeya24 merged 2 commits into
cortexproject:masterfrom
PaurushGarg:feat/selector-batch-size-config
Aug 14, 2026
Merged

expose SelectorBatchSize config for Thanos engine#7763
yeya24 merged 2 commits into
cortexproject:masterfrom
PaurushGarg:feat/selector-batch-size-config

Conversation

@PaurushGarg

@PaurushGarg PaurushGarg commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What this PR does:
Expose SelectorBatchSize from the Thanos promQL engine as a configurable flag for querier and ruler:

  • querier.selector-batch-size
  • ruler.selector-batch-size

The Thanos promQL engine's SelectorBatchSize controls how many series are processed per batch in selectors. When set, the engine allocates iterators lazily per batch instead of all upfront, and for instant queries releases them after each batch. This reduces peak memory for high-cardinality queries.

thanos-io/promql-engine#721 enabled lazy iterator allocation and SelectorBatchSize for certain query patterns. This PR exposes it as a Cortex configuration option.

Which issue(s) this PR fixes:
Fixes #

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]
  • docs/configuration/v1-guarantees.md updated if this PR introduces experimental flags

Signed-off-by: Paurush Garg <paurushg@amazon.com>
Signed-off-by: Paurush Garg <paurushg@amazon.com>
@PaurushGarg
PaurushGarg marked this pull request as ready for review August 13, 2026 20:23
Comment thread CHANGELOG.md
# Changelog

## master / unreleased
* [FEATURE] Engine: Add `-querier.selector-batch-size` and `-ruler.selector-batch-size` flags to configure series batching in the Thanos promQL engine. 0 disables batching. #7763

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, could you fix the changelog ordering?

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 14, 2026
@yeya24
yeya24 merged commit 31b3cff into cortexproject:master Aug 14, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/querier lgtm This PR has been approved by a maintainer size/M type/feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants