app/vmselect/promql: clarify comments on why the right side of if and and operators are executed at first

This commit is contained in:
Aliaksandr Valialkin 2022-02-03 00:26:14 +02:00
parent 10367d7e4c
commit 1173964d8d
No known key found for this signature in database
GPG key ID: A72BEC6CD3D0DED1

View file

@ -302,10 +302,10 @@ func evalExpr(ec *EvalConfig, e metricsql.Expr) ([]*timeseries, error) {
var tssLeft, tssRight []*timeseries
switch strings.ToLower(be.Op) {
case "and", "if":
// Fetch right-side series at first, since the left side of `and` and `if` operator
// usually contains lower number of time series. This should produce more specific label filters
// for the left side of the query. This, in turn, should reduce the time to select series
// for the left side of the query.
// Fetch right-side series at first, since it usually contains
// lower number of time series for `and` and `if` operator.
// This should produce more specific label filters for the left side of the query.
// This, in turn, should reduce the time to select series for the left side of the query.
tssRight, tssLeft, err = execBinaryOpArgs(ec, be.Right, be.Left, be)
default:
tssLeft, tssRight, err = execBinaryOpArgs(ec, be.Left, be.Right, be)