ClickHouse / ClickHouse/ClickHouse

ClickHouse Materialized View auto-runs after restart causing OOM loop

Open
#93,131 1 comment 0 reactions 0 assignees View on GitHub
comp-refreshable-materialized-view external question
Dominant language
C++
Stars
49.9k
Forks
9k
Avg merge
21h 32m
Merged PRs (30d)
515

Description

### Company or project name

_No response_

### Question

ClickHouse Materialized View auto-runs after restart causing OOM loop

I’m running ClickHouse in Docker on a high-memory server (~380GB RAM) to process large datasets.

I use several Materialized Views (MV) for heavy aggregation / transformation.
The problem is:

During MV refresh / backfill, ClickHouse consumes a huge amount of RAM

This leads to OOM, and the ClickHouse Docker container restarts

After restart, Materialized Views automatically start consuming data again

This creates a restart loop due to repeated memory spikes

What I want

I’m looking for a way to:

Prevent Materialized Views from automatically running after ClickHouse restart

Keep MVs in a stopped / disabled state by default

Manually start or attach MVs later via script or at a controlled time

Question

Is there a built-in way in ClickHouse to disable / pause Materialized Views across restarts?

Or any recommended pattern (detach/attach, settings, startup scripts, etc.) to control when MVs start consuming data?

Thanks in advance for any help or best practices.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.