Skip to content

MergeSelectsOptimizer should consider start, end or range of the selector #512

Open
@harry671003

Description

@harry671003

Issue

Consider the following query:

sum(rate(metric{node="node1"}[5m]))/count(max_over_time(metric{node="node"}[6m]))

The MergeSelectsOptimizer will try to optimize the LHS to matchers="{__name__='metric'}" and filters="{node='node1'}"

However, since the range of the selectors are different they still end up being hashed to different values in the SelectorPool.
The engine will end up making two selects to storage for {__name__='metric'}.

But in this case, it would have been more optimal if the LHS wasn't optimized.

Should the MergeSelectsOptimizer also consider the start, end and range of the selector when finding a replacement?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions