-
Notifications
You must be signed in to change notification settings - Fork 53
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
Improve Adhoc filter #120
Comments
Thanks @dsztykman The default will remain This will allow use of things like SAMPLE. |
@dsztykman I believe you are asking for a way to customize the adhoc filter. You can already customize the adhoc filter by creating a constant variable named |
You can customise with a static value to specify which table you are working on. |
We aren't clear what you mean @dsztykman |
No I didn't realize we could use |
I implemented |
No it's definitely not what I had in mind.
This will populate the different value in the adhoc filter, based on the column selected by the users. |
Maybe we should change the name |
Yeah that would be good, but I would also need a variable for the selected column, so I can I create a constant variable called |
Sorry im confused |
I think I got confused :) |
I discussed this with @dsztykman, and i think there are two requests here:
Allowing multiple ad-hoc filters, each with their own
This is imperfect since (2) might not always be viable but having a query for each column isn't better IMO - it would still require creation of lots of constant variables per column. |
Discussed with @bossinc The way we think about this is template variables give you full context of the column - allowing you to specify a query per column. With hundreds of columns, however, this results in hundreds of drop-downs. This isn't realistic. The other extreme (which is the current implementation of ad-hoc filters) is no context of the column. This means a single query for all columns - column values cant have a different ORDER and we can't filter them by a different date field. The compromise, especially for column-orientated dbs with many columns, is probably an ad-hoc filter which is table aware. Discussing with @bossinc this feels like a core Grafana request. Most columns in the same table would be ordered and filtered by the same time column for example. |
Closing. Please reopen if there is more to discuss. |
Is your feature request related to a problem? Please describe.
When you have a very large dataset spanning over multiple months/years, the adhoc query filter generates a single query:
SELECT DISTINCT $column FROM $table LIMIT 1000
This query can be very expensive as it can span over millions/billions of rows.
Also it'd be great to order the response by count or something else.
Describe the solution you'd like
We should add the timerange filter of the current dashboard into the adhoc filter.
So let's say your dashboard is doing now - 15 min the query should be something like:
SELECT DISTINCT $column FROM $table WHERE $__timeFilter($timecolumn) LIMIT 1000
Here the $__timeFilter would replace the query with the proper timerange.
Obviously you can't necessary know the name of the timefiltering column, so we should create a new constant variable like
clickhouse_adhoc_query_timecolumn
where user would specify the timecolumn to be used.In general customising the query filter generated would be very interesting.
Another option would be to create a variable like called
$adhoc_filtered_column
which would contain the value of the column selected by the user.And then let the user manage how the query filter is created with a constant variable
clickhouse_adhoc_query_filter
where user would use the$adhoc_filtered_column
and craft their own filters like:SELECT DISTINCT $adhoc_filtered_column FROM table WHERE $__timeFilter(timecolumn) ORDER BY COUNT() LIMIT 10
I prefer option 2 as the user can optimise and customise easily how they want to use adhocfilter
The text was updated successfully, but these errors were encountered: