Skip to content
StackDecode
System Design
4. Database FundamentalsAnimated

Materialised Views

A stored copy of a query result.

The idea

Unlike a normal view, results are saved and refreshed on a schedule or trigger, making heavy reads cheap.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

ClientCommand sideWrite DBQuery sideRead DBProjection
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Writes (commands) and reads (queries) use separate models.

step:
1/4
at:
Client
1/12

The green dot is a request moving through the system.

Step by step

  1. 1Define the query
  2. 2Store the result
  3. 3Refresh periodically or on change
  4. 4Read from the stored table

Where it is used

Dashboards and reports.

Watch out for

Data can be stale between refreshes.

Related