Any way to optimize the All value of a variable?

Dear all,
Thanks for you support on the following topic.

I have a dashboard linked to a MySQL data source in which there is a query based variable.
This variable can have, in some cases, hundreds of values so the All value gets translated into a very long IN (value1, value2, value3, … valueN) SQL condition.
This can easily become quite ineffective mainly when the value list is actually a partition of the whole set of data, in this case just removing the IN clause in the WHERE condition would lead to a much faster query.
Is there any way to modify the query based on the value of the dashboard variable?

I apologize if I was not clear and thank you for your time

Gaetano

You have still option to customize All value in the dashboard variable configuration. It can be for example *. Of course then you need update WHERE statement in the query - e.g. using regexp matching instead of IN operator and also you will need advance variable formatting, so generated query will have always correct SQL syntax.

Thank you! This is really smart, i tried it and it works very fine. How does this compare in terms of resource usage to the solution based on the list inclusion?

This topic was automatically closed after 365 days. New replies are no longer allowed.