Variable Query originating: "Error updating options: Maximum call stack size exceeded"

Hi!
I have a dashboard with some panels that contain SQL queries that fetch results from a data source. One of this panels has a query which in turn use the results of a variable query in the ‘where’ condition.
Example:

select *
from my_datasource 
where my_datasource.id in ($list_of_ids)

In the example above the $list_of_ids is my variable query which is fetching results on another different datasource. This panel works fine if the results from the variable query are few (dozens or hundreds) but I have some cases where the variable query get hundreds of thousands results and when that happens I get the following error message: "Error updating options: Maximum call stack size exceeded"

Is there a way to solve this issue?

Thanks in advance!