Materialized View Lifecycle
A Timeplus Materialized View maintains its internal state and can transition between different states.
Understanding these transitions is important for operating and troubleshooting Materialized View pipelines.
States
Materialized Views can exist in the following states. Some are transient (short-lived during transitions):
Initializing(transient): The view is being initialized.CheckingDependencies(transient): The system is verifying source dependencies.BuildingPipeline(transient): The query execution pipeline is being constructed.ExecutingPipeline: The view is running and executing its streaming query pipeline. This is the normal operating state.Error: The view encountered an error.Suspended: The view is inactive because it is not the Raft leader. Only the leader executes the pipeline. Suspended views act as standby replicas for failover.Paused: The view is paused, either due to thepause_on_startsetting or aSYSTEM PAUSEcommand.AutoRecovering(transient): The view is automatically recovering from transient errors.Resuming(transient): The view is transitioning fromPausedtoExecutingPipeline.Recovering(transient): The view is being manually recovered fromErrorstate usingSYSTEM RECOVER.
The state transitions are illustrated in the diagram below:

System Commands
Timeplus provides system commands to manage Materialized Views.
Pause Materialized View
SYSTEM PAUSE MATERIALIZED VIEW <db.mat_view_name> [PERMANENT];
When pausing a Materialized View:
- The leader triggers a checkpoint.
- The leader stops the query pipeline and marks the state as
Paused. - If
PERMANENTis specified, the system updatespause_on_start=truein the DDL metadata and commits it to the metastore.- This ensures the view remains paused even after node restarts.
- Without
PERMANENT, the view will resume automatically on restart.
Example:
SYSTEM PAUSE MATERIALIZED VIEW tumble_aggr_mv;
Resume Materialized View
SYSTEM RESUME MATERIALIZED VIEW <db.mat_view_name> [PERMANENT];
When resuming a view:
- The leader rebuilds the query pipeline.
- The pipeline recovers from the last checkpoint.
- If successful, the state transitions to
ExecutingPipelinestate.
Only paused Materialized Views can be resumed.
Example:
SYSTEM RESUME MATERIALIZED VIEW tumble_aggr_mv;
Abort Materialized View
Aborting is similar to pausing, but:
- No checkpoint is triggered.
- The
pause_on_startsetting is not modified in the DDL metadata.
SYSTEM ABORT MATERIALIZED VIEW <db.mat_view_name>;
Example:
SYSTEM ABORT MATERIALIZED VIEW tumble_aggr_mv;
Recover a Materialized View
Used to recover views in the Error state. Recovery involves:
- Re-initializing the query pipeline.
- Restoring state from the last checkpoint.
- Transitioning to ExecutingPipeline.
SYSTEM RECOVER MATERIALIZED VIEW <db.mat_view_name>;
Example:
SYSTEM RECOVER MATERIALIZED VIEW tumble_aggr_mv;
Transfer Materialized View Leader
For Materialized Views governed by Raft, you can transfer leadership to another replica. This helps balance workload or mitigate temporary issues.
SYSTEM TRANSFER LEADER <db.mat_view_name> <mat_view_shard_id> FROM <leader_node> TO <follower_node>;
The shard ID of a Materializzed View is always 1001.
Once transferred, the new leader continues execution from the last checkpoint.
Example:
SYSTEM TRANSFER LEADER tumble_aggr_mv 1001 FROM 1 TO 2;