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

fix: add limits to suggestion query #5984

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/query-service/app/clickhouseReader/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,9 @@ func (r *ClickHouseReader) getValuesForLogAttributes(
) ([][]any, *model.ApiError) {
// query top `limit` distinct values seen for `tagKey`s of interest
// ordered by timestamp when the value was seen

// we added the settings max_rows_to_group_by=100, group_by_overflow_mode = 'break'
// to avoid query from taking up all the resources when value is high cardinality.
query := fmt.Sprintf(
`
select tagKey, stringTagValue, int64TagValue, float64TagValue
Expand All @@ -4383,7 +4386,7 @@ func (r *ClickHouseReader) getValuesForLogAttributes(
max(timestamp) as ts
from %s.%s
where tagKey in $1
group by (tagKey, stringTagValue, int64TagValue, float64TagValue)
group by (tagKey, stringTagValue, int64TagValue, float64TagValue) SETTINGS max_rows_to_group_by = 100, group_by_overflow_mode = 'break', max_threads=4
)
)
where rank <= %d
Expand Down
Loading