documentation/query/sql/alter-mat-view-resume-wal.md
Restarts WAL transactions on a materialized view after resolving errors that caused suspension.
ALTER MATERIALIZED VIEW viewName RESUME WAL [ FROM TRANSACTION sequencerTxn ]
| Parameter | Description |
|---|---|
viewName | Name of the materialized view to resume |
FROM TRANSACTION | Optional starting transaction number (defaults to failed transaction) |
Use this command when a materialized view's WAL processing has been suspended
due to an error. The view will be marked as suspended = true in the
wal_tables() output.
Use wal_tables() to identify
suspended views:
wal_tables();
| name | suspended | writerTxn | sequencerTxn |
|---|---|---|---|
| trades_1h | true | 3 | 5 |
The trades_1h view is suspended. The last successful commit was transaction
3.
Restart processing from the next transaction after the last successful one:
ALTER MATERIALIZED VIEW trades_1h RESUME WAL;
This resumes from transaction 4 (the failed transaction).
Skip problematic transactions by specifying a starting point:
ALTER MATERIALIZED VIEW trades_1h RESUME WAL FROM TRANSACTION 5;
| Aspect | Description |
|---|---|
| Default resume point | Resumes from the transaction after writerTxn |
| Skipped transactions | When using FROM TRANSACTION, earlier transactions are skipped |
| Error resolution | Fix the underlying issue before resuming, or skip past it |
Resuming WAL on a materialized view requires the ALTER MATERIALIZED VIEW
permission on the specific view:
GRANT ALTER MATERIALIZED VIEW ON trades_1h TO user1;
| Error | Cause |
|---|---|
materialized view does not exist | View with specified name doesn't exist |
view is not suspended | WAL is already running normally |
permission denied | Missing ALTER MATERIALIZED VIEW permission (Enterprise) |