SYSTEM Statements

SYSTEM RESTART REPLICA test;
SYSTEM RESTORE REPLICA test;
```

Another way:

```
SYSTEM RESTORE REPLICA test ON CLUSTER cluster;
```

### SYSTEM RESTART REPLICAS[​](#restart-replicas "Direct link to SYSTEM RESTART REPLICAS")

Provides possibility to reinitialize Zookeeper sessions state for all `ReplicatedMergeTree` tables, will compare current state with Zookeeper as source of true and add tasks to Zookeeper queue if needed

### SYSTEM CLEAR|DROP FILESYSTEM CACHE[​](#drop-filesystem-cache "Direct link to SYSTEM CLEAR|DROP FILESYSTEM CACHE")

Allows to drop filesystem cache.

```
SYSTEM CLEAR FILESYSTEM CACHE [ON CLUSTER cluster_name]
```

### SYSTEM SYNC FILE CACHE[​](#sync-file-cache "Direct link to SYSTEM SYNC FILE CACHE")

Note

It's too heavy and has potential for misuse.

Will do sync syscall.

```
SYSTEM SYNC FILE CACHE [ON CLUSTER cluster_name]
```

### SYSTEM LOAD PRIMARY KEY[​](#load-primary-key "Direct link to SYSTEM LOAD PRIMARY KEY")

Load the primary keys for the given table or for all tables.

```
SYSTEM LOAD PRIMARY KEY [db.]name
```

```
SYSTEM LOAD PRIMARY KEY
```

### SYSTEM UNLOAD PRIMARY KEY[​](#unload-primary-key "Direct link to SYSTEM UNLOAD PRIMARY KEY")

Unload the primary keys for the given table or for all tables.

```
SYSTEM UNLOAD PRIMARY KEY [db.]name
```

```
SYSTEM UNLOAD PRIMARY KEY
```

## Managing Refreshable Materialized Views[​](#managing-refreshable-materialized-views "Direct link to Managing Refreshable Materialized Views")

Commands to control background tasks performed by [Refreshable Materialized Views](/docs/sql-reference/statements/create/view#refreshable-materialized-view)

Keep an eye on [`system.view_refreshes`](/docs/operations/system-tables/view_refreshes) while using them.

### SYSTEM STOP [REPLICATED] VIEW, STOP VIEWS[​](#stop-view-stop-views "Direct link to SYSTEM STOP [REPLICATED] VIEW, STOP VIEWS")

Disable periodic refreshing of the given view or all refreshable views. If a refresh is in progress, cancel it too.

If the view is in a Replicated or Shared database, `STOP VIEW` only affects the current replica, while `STOP REPLICATED VIEW` affects all replicas.

Note

The stopped state does not persist across server restarts. After a restart, views will resume their configured refresh schedules.
In Replicated or Shared databases, `SYSTEM STOP VIEW` only affects the current replica. Use `SYSTEM STOP REPLICATED VIEW` to stop refreshes on all replicas.

```
SYSTEM STOP VIEW [db.]name
```

```
SYSTEM STOP VIEWS
```

### SYSTEM START [REPLICATED] VIEW, START VIEWS[​](#start-view-start-views "Direct link to SYSTEM START [REPLICATED] VIEW, START VIEWS")

Enable periodic refreshing for the given view or all refreshable views. No immediate refresh is triggered.

If the view is in a Replicated or Shared database, `START VIEW` undoes the effect of `STOP VIEW`, and `START REPLICATED VIEW` undoes the effect of `STOP REPLICATED VIEW`.

```
SYSTEM START VIEW [db.]name
```

```
SYSTEM START VIEWS
```

### SYSTEM REFRESH VIEW[​](#refresh-view "Direct link to SYSTEM REFRESH VIEW")

Trigger an immediate out-of-schedule refresh of a given view.

```
SYSTEM REFRESH VIEW [db.]name
```

### SYSTEM WAIT VIEW[​](#wait-view "Direct link to SYSTEM WAIT VIEW")

Waits for the running refresh to complete. If no refresh is running, returns immediately. If the latest refresh attempt failed, reports an error.

Can be used right after creating a new refreshable materialized view (without EMPTY keyword) to wait for the initial refresh to complete.

If the view is in a Replicated or Shared database, and refresh is running on another replica, waits for that refresh to complete.

```
SYSTEM WAIT VIEW [db.]name
```

### SYSTEM CANCEL VIEW[​](#cancel-view "Direct link to SYSTEM CANCEL VIEW")

If there's a refresh in progress for the given view on the current replica, interrupt and cancel it. Otherwise do nothing.

```
SYSTEM CANCEL VIEW [db.]name
```

## SYSTEM FLUSH OBJECT STORAGE QUEUE[​](#flush-object-storage-queue "Direct link to SYSTEM FLUSH OBJECT STORAGE QUEUE")

Blocks until the given file has been processed or permanently failed by the given [S3Queue](/docs/engines/table-engines/integrations/s3queue) or [AzureQueue](/docs/engines/table-engines/integrations/azure-queue) table. Returns immediately if the file was already processed. Raises an error if the file has permanently failed (all retries exhausted).

```
SYSTEM FLUSH OBJECT STORAGE QUEUE [db.]table_name PATH 'path'
```