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

Metaqueries to list field values take slow path when the only predicate is _measurement #21961

Closed
williamhbaker opened this issue Jul 28, 2021 · 0 comments · Fixed by #21962
Closed
Assignees
Labels
area/flux Issues related to the Flux query engine area/performance

Comments

@williamhbaker
Copy link
Contributor

In #19856, an alternate path was implemented for retrieving values from the store to satisfy queries for getting tag values for _field, where there is a predicate on anything except _measurement (see associated issue: #19794). This alternate path involves scanning through all series in the shards within the specified time range, and is considerably slower than the standard path.

A common metaquery used by the UI is to retrieve all fields for a certain _measurement. It might look something like this:

from(bucket: "bucket")
  |> range(start: -30d)
  |> filter(fn: (r) => (r["_measurement"] == "measurement_name"))
  |> keep(columns: ["_field"])
  |> group()
  |> distinct(column: "_field")
  |> limit(n: 200)
  |> sort()

This query has a predicate only on _measurement, and should not have to take the alternate path. However, the current implementation does cause this query to take the alternate path and thus potentially take longer to execute than it would need to.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/flux Issues related to the Flux query engine area/performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant