Skip to main content

Overview

ALTER commands allow you to modify existing database objects in Materialize. These commands let you change object properties, rename objects, and update configurations without recreating them.

Available ALTER Commands

ALTER CLUSTER

Modify cluster configuration, including replicas and scheduling

ALTER INDEX

Rename indexes or change their cluster assignment

ALTER SOURCE

Modify source properties and cluster assignment

ALTER MATERIALIZED VIEW

Change materialized view configuration and cluster

ALTER VIEW

Rename views

ALTER SINK

Modify sink properties

ALTER TABLE

Add or rename columns in tables

ALTER SECRET

Modify secret values

ALTER ROLE

Change role attributes

ALTER SYSTEM

Set or reset system configuration parameters

Common Use Cases

Rename an Object

-- Rename a materialized view
ALTER MATERIALIZED VIEW old_name RENAME TO new_name;

-- Rename a source
ALTER SOURCE old_source RENAME TO new_source;

Change Cluster Assignment

-- Move a materialized view to a different cluster
ALTER MATERIALIZED VIEW my_view SET CLUSTER = compute_cluster;

-- Move a source to a different cluster
ALTER SOURCE my_source SET CLUSTER = ingest_cluster;

Modify Cluster Configuration

-- Rename a cluster
ALTER CLUSTER old_cluster RENAME TO new_cluster;

-- Set cluster replication factor
ALTER CLUSTER my_cluster SET (REPLICATION FACTOR = 2);

Update System Parameters

-- Set a system parameter
ALTER SYSTEM SET statement_timeout = '30s';

-- Reset to default
ALTER SYSTEM RESET statement_timeout;

Important Considerations

Some ALTER operations may cause brief interruptions to query execution or data ingestion. Plan changes during maintenance windows when possible.
  • Renaming objects updates all dependencies automatically
  • Changing cluster assignments may cause brief downtime during the transition
  • ALTER operations are transactional and atomic
  • Not all object properties can be modified with ALTER; some require recreating the object

Restrictions

  • You cannot alter an object’s fundamental type (e.g., convert a view to a materialized view)
  • Some properties are immutable and require dropping and recreating the object
  • Certain operations require ownership or specific privileges

CREATE Commands

Create new database objects

DROP Commands

Remove existing database objects

SHOW Commands

Inspect database objects

GRANT/REVOKE

Manage object privileges

Build docs developers (and LLMs) love