Redash查询缓存失效求助:自托管AMI版本Athena查询无缓存
Hey there, let's troubleshoot why your Athena queries aren't caching in your self-hosted Redash instance—even with default settings. I’ve run into similar issues before, so here are the key areas to check step by step:
Even though you mentioned default configs, it’s worth confirming these basics first:
- Go to Admin > Settings in Redash. Look for the
ENABLE_QUERY_CACHEtoggle—make sure it’s set totrue(this is default, but accidental changes happen). Also verifyQUERY_CACHE_TTL(default is 900 seconds / 15 minutes); if it’s set to0, caching will be disabled entirely. - For individual queries: Open the query editor, click the Settings button in the top-right, and check if
Cache Resultsis enabled. By default this inherits the global setting, but it might have been manually toggled off for specific queries.
Redash’s cache works independently of Athena’s own result cache, but query structure can break both:
- Athena treats queries as unique if they have dynamic values (like
CURRENT_TIMESTAMP, random strings, or auto-generated parameters). If your query uses these, even small differences will make Athena re-run it—and Redash won’t cache results that change on every execution. Try replacing dynamic values with fixed ones temporarily to test if caching kicks in. - Note that some Athena query types don’t support its native cache (e.g., queries involving external tables, Lambda UDFs, or
TABLESAMPLE). Even so, Redash should still cache the results it receives—unless the query returns different data every time.
The official Redash AMI uses Redis as the default cache backend—if it’s down or misconfigured, caching fails silently:
- SSH into your Redash server and run
redis-cli ping. If you get aPONGresponse, Redis is running. If not, restart it withsudo systemctl restart redis-server. - Check if Redash is actually writing to Redis: Run
redis-cli keys "query_result:*". If you see a list of keys, caching is active; if empty, Redash isn’t connecting to Redis properly. - Verify the Redis URL in Redash’s config file (
/opt/redash/.env). Look forREDIS_URL—it should point to your local Redis instance, likeredis://localhost:6379/0. A wrong URL here breaks the cache connection.
Even if you didn’t see errors, dig deeper into worker logs for cache-related activity:
- Run
sudo journalctl -u redash-workerto view worker logs. Search for keywords likeCaching query resultorUsing cached result. If you don’t see these lines, Redash isn’t triggering its caching logic at all. - Look for any subtle errors related to cache storage—maybe permissions issues with Redis, or a full Redis instance (though that’s less likely with default setups).
It’s a long shot, but individual user settings can override global cache rules:
- Have the affected user go to their Profile > Settings and check if
Disable Query Cacheis toggled on. This setting overrides global and query-specific cache rules for that user.
内容的提问来源于stack exchange,提问作者Nipun

