Metabase Caching Setting

Hi Metabase Team,
I have noticed that some of my questions take more than 50 seconds to run due to the live nature of the data. This can be frustrating and time-consuming, especially when I need to run multiple queries. After researching, I realized that caching could be a solution to speed up the queries that take longer than a certain threshold.

I am reaching out to ask if you could guide me on how to enable caching for questions that take more than 10 seconds and refresh the cache every 24 hours? I believe this could significantly improve the performance of my queries, and make my work more efficient.

I appreciate any guidance you can provide on this matter


r, and once again, thank you for creating such a powerful and useful tool.

Hi! Cache is not refreshed automatically. Those configurations are fine for what you want to achiever

Cache is not refreshed automatically so o have to run the question manual

i want to update it every 24 hours and 100 ttl it's per second

yes, you will need to refresh the cache manually or programatically (running those questions via the API)

How I do it programmatically

Build a script with the language of your choice that calls the Metabase APIs to run the questions

Hi @Luiggi , sorry if this is an annoying question! But I've tried googling this and asking chatgpt and there's no consistent answer. You said:

Build a script with the language of your choice that calls the Metabase APIs to run the questions

I'm happy to do this, but could you tell me WHICH endpoint one should call which runs a question in such a way that it gets cached?

I have very impatient users who, if they catch a question once the cache has expired, they give up. So I'd like to "pre cache" questions so that when they access the UI, they ALWAYS get the cached version.

Which endpoint do I call to do this? is it the /card/{{id}}/query one, or the /card/{{id}}/refresh one, or something else?

thanks so much

@thatandyrose e.g. for question with the Id of 1:
yourmetabaseurl/api/card/1

regards

1 Like

thanks so much @Luiggi !