You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running Trino against an Iceberg catalog and want to cache query results in Redis, with cache invalidation tied to the Iceberg snapshot_id of the tables involved — i.e. serve from cache as long as the underlying table hasn't changed, and automatically refresh the moment it has.
I've already built this as an external proxy (caches on query text + combined snapshot_id of all referenced tables, checks "<table>$snapshots" before serving), and it works. Before I invest further, two questions:
1. Is there any native support for this in Trino or Redis?
From what I've found so far, there isn't:
Trino's Redis connector queries Redis as a data source — it doesn't cache Trino query results.
Open-source Trino has no built-in result cache (I believe this is a Starburst Enterprise-only feature, not in OSS).
Redis Smart Cache (Redis Inc.'s JDBC wrapper) caches results, but only on a TTL — no concept of Iceberg snapshots, so it can't auto-invalidate the instant a table changes.
Is that accurate, or is there a coordinator property, SPI hook, or plugin I'm missing?
2. If not — does an Event Listener + Redis Smart Cache combination make sense as a lower-effort alternative to a full custom proxy?
Idea: use Trino's [Event Listener SPI](https://trino.io/docs/current/develop/event-listener.html) to detect QueryCompletedEvents where a table was written to (INSERT/UPDATE/MERGE/DELETE), and on that event, delete/invalidate the relevant keys in Redis. Redis Smart Cache would handle the actual query-result caching/serving mechanics, so I'd only need to write the invalidation trigger rather than a full caching layer.
Has anyone tried this combination? Any gotchas with relying on Event Listener firing reliably as the invalidation trigger, versus checking snapshot_id directly like my current proxy does?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hi all,
I'm running Trino against an Iceberg catalog and want to cache query results in Redis, with cache invalidation tied to the Iceberg
snapshot_idof the tables involved — i.e. serve from cache as long as the underlying table hasn't changed, and automatically refresh the moment it has.I've already built this as an external proxy (caches on query text + combined snapshot_id of all referenced tables, checks
"<table>$snapshots"before serving), and it works. Before I invest further, two questions:1. Is there any native support for this in Trino or Redis?
From what I've found so far, there isn't:
Is that accurate, or is there a coordinator property, SPI hook, or plugin I'm missing?
2. If not — does an Event Listener + Redis Smart Cache combination make sense as a lower-effort alternative to a full custom proxy?
Idea: use Trino's [Event Listener SPI](https://trino.io/docs/current/develop/event-listener.html) to detect
QueryCompletedEvents where a table was written to (INSERT/UPDATE/MERGE/DELETE), and on that event, delete/invalidate the relevant keys in Redis. Redis Smart Cache would handle the actual query-result caching/serving mechanics, so I'd only need to write the invalidation trigger rather than a full caching layer.Has anyone tried this combination? Any gotchas with relying on Event Listener firing reliably as the invalidation trigger, versus checking snapshot_id directly like my current proxy does?
Thanks!
All reactions