View the original community article here
Last tested: Feb 6, 2020
The System Activity history history table fields about cache require a bit of background to be understood and used effectively. The following will help clear up what the fields mean.
In general, when a query is run, Looker checks render cache first, then results cache (that's because render cache is quicker to check, because we don't need to generate the sql to create the render key - to create the results cache key, the sql needs to be generated). More details about render cache vs results cache here.
About the Cache (Yes/No) field from the System Activity history explore: If the result is "Yes", that means that Looker *tried* to check cache - so even if we didn't pull the results from cache, the field can still be "Yes". If the result is "No", that means the query was requested to skip checking cache - for example, the result would be "No" if the query came from clear cache and refresh, an instant dashboard reload (after a stale result was shown), or a dashboard on a refresh interval.
It's helpful to add the Result source, Cache key (this is the results cache key) and the Render key fields to your System Activity query - this will help determine where the results of the query came from.
Some cases explained:
If you see that Cache (Yes/No) = "Yes", and result_source is "query": this means we tried to check cache, and resorted to sending a query to the database. In this case there's always going to be a render key + a cache key, because Looker checked the render cache (creating a render key), didn't see results, then moved on to check the results cache (creating a results cache key), didn't see results, so finally resorted to running the query against the database.
If Cache (Yes/No) = "Yes", and result source is null: this means that the query result came from render cache (cache key will always be null). We checked render cache, found results, and didn't create a cache key because we didn't need to check results cache.
If Cache (Yes/No) = "Yes", and result_source is "cache": we can check whether it came from render/results cache by including the key fields. If the cache key is null, then the query came from render cache. If neither are null, that means the query came from results cache (tried render, then results cache - since source = cache, we got the results there).