Skip to main content
You can modify SELECT query that was specified when a materialized view was created with the ALTER TABLE ... MODIFY QUERY statement without interrupting ingestion process. This command is created to change materialized view created with TO [db.]name clause. It does not change the structure of the underlying storage table and it does not change the columns’ definition of the materialized view, because of this the application of this command is very limited for materialized views are created without TO [db.]name clause. Example with TO table
Example without TO table The application is very limited because you can only change the SELECT section without adding new columns.

Required privileges

ALTER TABLE ... MODIFY QUERY requires the ALTER VIEW MODIFY QUERY privilege on the view. The new query runs with the SQL security of the view, so the statement also requires the grants that are necessary to create a view with that SQL security:
  • SQL SECURITY DEFINER with a definer that is not the current user: SET DEFINER on that definer.
  • SQL SECURITY NONE: ALLOW SQL SECURITY NONE.
When the same statement changes the SQL security with MODIFY SQL SECURITY, these grants are required for the new SQL security instead of the old one. With ON CLUSTER, the statement is authorized on the host where it runs, so that host must have the view. Otherwise the statement fails with UNKNOWN_TABLE.

ALTER TABLE … MODIFY REFRESH Statement

ALTER TABLE ... MODIFY REFRESH changes refresh parameters of a Refreshable Materialized View, including the schedule, dependencies, randomization, and refresh settings.
The schedule (EVERY or AFTER) is mandatory: the statement replaces all refresh parameters at once. Any clause not specified — RANDOMIZE FOR, DEPENDS ON, or SETTINGS — is removed or reset to defaults. To change only refresh settings, repeat the current schedule. The command updates the refresh configuration of the existing view in place without recreating the materialized view or its target table, clearing existing target data, or canceling an already-running refresh. Reads continue against the existing target table while the configuration is changed. Repeating the command with the same complete REFRESH specification is safe. Make sure to repeat every clause that should remain configured, because each execution replaces all refresh parameters as described above.
Limitations:
  • ALTER TABLE ... MODIFY SETTING is not supported on materialized views; refresh settings can only be changed via MODIFY REFRESH.
  • Adding or removing APPEND is not supported.
  • The all_replicas refresh setting cannot be changed after the view is created.
The full list of refresh settings is documented in Refresh Settings. Refresh status, including the currently applied settings, is visible in system.view_refreshes.
Last modified on October 3, 2026