docs/reference/rules/require-concurrent-refresh-matview.md
Diagnostic Category: lint/safety/requireConcurrentRefreshMatview
Since: vnext
[!NOTE] This rule is recommended. A diagnostic error will appear when linting your code.
Sources:
REFRESH MATERIALIZED VIEW without CONCURRENTLY acquires an ACCESS EXCLUSIVE lock.
This blocks all reads on the materialized view until the refresh completes.
Use REFRESH MATERIALIZED VIEW CONCURRENTLY to allow reads during the refresh.
Note: concurrent refresh requires a unique index on the materialized view.
refresh materialized view my_view;
code-block.sql:1:1 lint/safety/requireConcurrentRefreshMatview ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
! REFRESH MATERIALIZED VIEW without CONCURRENTLY blocks all reads.
> 1 │ refresh materialized view my_view;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │
i Use REFRESH MATERIALIZED VIEW CONCURRENTLY to allow reads during the refresh. This requires a unique index on the view.
refresh materialized view concurrently my_view;
{
"linter": {
"rules": {
"safety": {
"requireConcurrentRefreshMatview": "error"
}
}
}
}