Concepts

Vocabulary

ViewModel
A named composite model (aggregate/join) over source tables, defined in a *.model.ts file.
Watched columns
The subset of source columns whose changes trigger a re-project. Unwatched columns produce no work.
Projector
A SQL function that takes a set of keys and returns the current composite row(s).
Key map
SQL that maps a changed source row to the ViewModel key(s) it affects.
Delta
A captured insert/update/delete on a source table.
Outbox
A transactional table storing every materialized change for subscriber consumption.

Three guarantees

  1. Conditional — a view is enqueued only when an intersected watched column actually changes (IS DISTINCT FROM).
  2. Incremental — only affected keys are recomputed, not the whole view.
  3. Consistent — after the queue drains, mv_<view> equals a full re-projection from scratch.

Refresh strategies

StrategyTargetWhen
INCREMENTALManaged tableAggregations/joins keyed by stable id
PARTIAL_KEYManaged tableLarge tables where few keys change
FULLNative MVSmall/cheap views or bootstrap