.servedFromCache returns false even though cache is activated in advenced query settings

Dear Community,
I was reading this article https://docs.retool.com/docs/caching-in-retool since I wanted to cache a heavy query at least for 3600s so that user experience would be better.

So I tried to cache the query and didn´t have the feeling it worked. So I checked with the .servedFromCache and it returns false (first picture). What might I be doing wrong here? I am quering a Postgresql Query from my library in a module (second picture).

image

Thank you in advance!

1 Like

Hey @Leon!

This may actually be caused by a known bug - query library queries aren't respecting caching settings properly, our dev team is looking into it and we can let you know here when there's a fix. In the meantime, you might try setting the query up without using the query library to see if you're able to cache it that way.

Hey @Kabirdas

Thank you for the quick reply! A shame those query library queries aren´t respecting caching. Would be a huge improvement to retool so I am looking forward to this bug beeing fixed.
I have another question: Caching in general does not work for public Links, right? It´s only thought for logged in users?

Query caching in public apps is also something that's being looked into - I'll let you know here when that's working as well! :slightly_smiling_face:

1 Like

@Kabirdas - Is there a place query caching is currently working ?

I couldn't get query caching to work in a module, neither from the query library nor outside query library (standalone query inside a module, not imported)

Hey @fragrant_issues!

Queries should still be able to serve their results from a cache when they aren't imported from the query library. If this isn't working it might help to get additional context. What kind of query are you running? Could you share any screenshots of your configuration?

Hey @Kabirdas, I have a reduced test case you can look at. We are pulled order data from Google BigQuery and the cache is working through the in-app query, but not for the one from the query library. We would really like to use the query library. Can this be fixed?

I want to report the opposite where an imported query from the Query Library was using the cache successfully, when I went to invalidate it or remove the caching, it continues to pull from the cache regardless of turning off the cache setting.


You'll see in the bottom right corner servedFromCache is still true after disabling the setting.

Hey @dlk!

Thanks for reporting that extra wrinkle. When was this particular query created? Are you seeing similar behavior in any of your other Query Library queries?

The Query Library query and the import of it were created in the last 6 months, somewhere in July - September 2022 is my best recollection.

I'll see if I can replicate the issue with other Query Library queries and their imports.

@Kabirdas Any update here? It's one thing that this has now been a somewhat longstanding bug, but it's another that right in the Advanced tab the "Enable caching" option is just taunting us!

Can't that option at least be disabled or hidden for Query Library queries until the dev team figures this out? Otherwise it's very misleading.

I remember when I first reported this issue directly to support investigating what was happening took up an hour or two of my time making sure I hadn't messed up something else (it was in the context of a pretty hefty internal app).

I wonder how many other people might be saved the same trouble by a simple disclaimer / UI change.

@dguzzo, I don't have an update, but I can tell you that the ticket is in their engineering queue and that no one has picked it up yet. I have an ongoing chat thread with support going back to Dec 6, 2022 and every few weeks I ask for an update. Here are all the relevant responses I've been given regarding the status of the Query Library caching issue:

Dec 6, 2022

You're correct! This is indeed a known issue. I've updated the bug report and linked this thread so we can reach out with any updates or progress on the ticket. This is still in the queue to be picked up, so there's not a concrete timeline I can provide for you at the moment, unfortunately.

Dec 19, 2022

Unfortunately, I don't have an update on the Query Library caching issue yet -- it's still in the Engineering queue to be fixed. It does look like we intend to fix it, but there's no timeline I can provide for it at the moment.

Jan 17, 2023

I'm still waiting to hear back from our engineering team on a more clear timeline for this. It doesn't look like they've committed to a date yet, but I'm trying to get a more detailed report for you.

1 Like

Hey folks! Sorry for the late reply here, but thanks for the bumps! The eng team will be taking a closer look at this.

In the meantime, it looks like if you extract a query to the query library from an app it keeps whatever caching setting it had at the moment you extracted it:

If you'd like a query to run either cached on uncached you might try extracting two copies to the query library that are labeled accordingly:

I know this doesn't help with the confusion of seeing the setting after it's in the query library but hopefully it does help in some cases!

Hi @Kabirdas, just checking in to see if there are any updates on the Query Library caching issue. Any information on the progress of the fix would be helpful.

Hey @barton!

It looks like @dvdhsu already responded in a separate thread but I just want to confirm here as well that the devs are actively working on a fix :slightly_smiling_face:

It looks like they've released a fix. My reduced test case page is showing my query library query being cached.

1 Like

Hi @barton, we pushed out a fix for this three days ago. Thank you for reporting the bug, and for bumping it! Glad we could get it resolved. :slight_smile:

2 Likes

Thanks @dvdhsu! This was the biggest hurdle preventing us from moving our reports over from Looker Studio.

1 Like

@dvdhsu, do you know if this fix is included in the self-hosted release 2.115? Release notes don't indicate if it is.

Hey @derekchisholm, this should be included for self-hosted users at or above 2.117!