-
Notifications
You must be signed in to change notification settings - Fork 6
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
Group indexes by prefix (common table) #1175
base: main
Are you sure you want to change the base?
Conversation
quesma/quesma/config/config_v2.go
Outdated
if defaultIngestConfig, ok := queryProcessor.Config.IndexConfig[DefaultWildcardIndexName]; ok { | ||
conf.DefaultQueryOptimizers = defaultIngestConfig.Optimizers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you forget to change name to defaultQueryConfig
? If not, I don't know what's going on here 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. Fixed.
if opt, ok := s.cfg.DefaultQueryOptimizers[groupByCommonTableIndexes]; ok { | ||
if !opt.Disabled { | ||
for k, v := range opt.Properties { | ||
if v != "false" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can v
be only true
or false
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a boolean flag for now.
|
||
for _, indexName := range query.Indexes { | ||
indexWhere = append(indexWhere, model.NewInfixExpr(model.NewColumnRef(common_table.IndexNameColumn), "=", model.NewLiteral(fmt.Sprintf("'%s'", indexName)))) | ||
var added bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nitpick: This body could be separate function
When Grafana queries daily indexes:
So if we have a 3-year time range, Grafana will send 1k+ indexes in the query. We transform that list into an
OR
expression, and hit the query limit.This PR adds an optimizer that transforms the
OR
expressions into a singlestarsWith
expression when indexes share the same prefix.If we have indexes with a pattern
daily-YYYYMMDD,
we can enable the optimizer: