Materialised views and caching
Lesson 3 of 5 in Analyzing Data.
There are four places an answer can be remembered on this platform, and the thing to notice is that every one of them is a trade of freshness for cost or speed — but each one invalidates on a different trigger, which is why "the dashboard is showing yesterday's number" has four possible explanations that look identical.
- Redshift result caching — leader-node memory, on by default, free. Invalidated when the underlying tables change.
- Materialized views — stored results in the warehouse, refreshed incrementally or fully, manually or automatically. Invalidated only by a refresh.
- Athena query result reuse — opt-in, serves a stored result for an identical query within a maximum age. Invalidated only by that age, never by new data landing in S3.
- QuickSight SPICE — an imported snapshot in the BI tool. Invalidated only by a refresh, and a failed refresh is invisible to the reader.
Read that list again as a staleness risk ranking and it reorders itself. The result cache is the safest because the data itself invalidates it. Materialized views are next, because you control the refresh and can reason about it. Athena result reuse and SPICE are the dangerous ones, because in both cases new data arriving changes nothing, and the only thing standing between a reader and a stale number is a setting somebody chose months ago.
| Cache | On by default | Invalidated by | The staleness failure mode |
|---|---|---|---|
yes, and free | any modification to the referenced tables or views | none — but it also never applies to Spectrum queries or to | |
no — you create it | a refresh, manual or automatic | an auto refresh delayed by load, or a full recompute forced by | |
no — opt in per query or workgroup | the configured maximum age, nothing else | new objects in S3 are invisible to it for up to 7 days | |
chosen per dataset against direct query | a successful scheduled or API refresh | a failed refresh serves the old snapshot with no visible error |
Key terms: Materialized view, Redshift result caching, Athena query result reuse, SPICE, Freshness check
Interactive checkpoint quiz (2 questions) — open this page in a browser to take it.