Filtering cached results without reloading queries in Metabase

Hello !
I have questions that take a long time to load, so I'm caching them, and I'd like to know if, when I apply filters to these questions, there's a way to fetch from the cached results rather than reloading the query? I've seen that I can do this with persisted models, but is that the only solution?

The manual implies that filters create their own cached query. Metabase doesn’t do its own filtering, it relies on the database to do that. But the filtered query will be cached on its own.

Persisted models are materialized views. Queries against them can be cached, of course. But Metabase does not create or manage indexes on those materialized views (if supposed by your database), so performance can be poor but, if the source query is long & complex, it is still likely faster.

I’m not sure if I explained myself well.

What I want is this: when I apply a filter in my Dashboard that affects one of the questions in that Dashboard, I want it to automatically reload the question with that parameter, which gets incorporated into the SQL query and therefore reloads the query.

But if the results of that same query (without any filters applied) are already cached, is there a way for the filter to be applied directly to those cached results instead of reloading the query and calling the database again?​​​​​​​​​​​​​​​​

No, Metabase must issue a new query with the new query parameters. It doesn’t know what the parameters are ultimately doing. The query could have different results than what may seem obvious.

It will cache the result of the query plus its parameters, so if someone looks at the same dashboard with the same filters set they will get the cached copy of the queries.

Maybe on option “Filter on cache’s results” could be a great idea ? If I have 50k rows in my first query that takes a lot to load and I want to filter after on one name for example if i have to reload this query it takes time.
Buuuut if i can reload this query on something that is in cache :slight_smile:
That’s what persistent model are doing but I dont want to write on my DB :rofl: